MobilePro #55: WeatherKit Subscriptionsâ, Animated Balloons in Reactđ, Java Conferencesâ
We're back with another edition of the _mobilepro and we've got Android, Apple and React Native- Android brings Jetpack Compose lessons closer to home with bootcamps near you, Apple's WeatherKit and Live Activity releases, and a new version of React.
This week, we have curated articles that showcase:
Functions in Kotlin
Google Maps in Jetpack Compose
Switching Fragments with Code
Animated Balloons in React Native
We will also continue 'Your First...' tutorial series with Writing Your First Java Code.
 As always, check out our survey and tell us what you want us to cover - the _mobilepro only works thanks to its community, so we need the community to tell us what it wants! Please hit the button to share your inputs, first 50 respondents will receive a free best-selling eBook PDF.
COMPLETE SURVEY AND GET A FREE PDF DOWNLOAD
Cheers,
Apurva Kadam
Associate Editor-in-Chief, Packt
Whatâs happening in Tech?
Android
Learn Jetpack Compose at a Compose Camp near you! - Jetpack Compose is Android's modern toolkit that simplifies Android UI development. It's already used by thousands of apps around the world such as Twitter, Airbnb and Google Play; if you're not already using it, it's a great time to start. To make learning Compose even easier, the company launching Compose Camp, a series of in-person and virtual sessions where you can learn how to build Android apps with Jetpack Compose alongside your peers. Grab your âcamping gearâ and see how you can participate in a Compose Camp near you!
Apple
WeatherKit subscriptions now available - Itâs easy to use WeatherKit in your apps for iOS 16, iPadOS 16, macOS 13, tvOS 16, and watchOS 9 with a platform-specific Swift API, and on any other platform with a REST API. Up to 500,000 API calls per month are included with Apple Developer Program membership. And now, Account Holders can subscribe for more calls in the Apple Developer app.
Develop for Live Activities with iOS 16.1 beta and Xcode 14.1 beta - Discover how you can build Live Activities for your apps using the new ActivityKit framework, now available in iOS 16.1 beta and Xcode 14.1 beta. Live Activities help people keep track of your appâs content with real-time updates. Your appâs Live Activities display on the Lock Screen and in Dynamic Island â a new design that introduces an intuitive, delightful way to experience iPhone 14 Pro and iPhone 14 Pro Max. Live Activities and ActivityKit will be included in iOS 16.1, available later this year.Â
ÂGet ready with the latest beta releases - The beta versions of Xcode 14.1, iOS 16.1, iPadOS 16.1, tvOS 16.1, and watchOS 9.1 are now available. Get your apps ready by confirming they work as expected on these releases. And to take advantage of the advancements in the latest SDKs, make sure to build and test with Xcode 14.1 beta.
React Native
Announcing React Native 0.70 â The company release a new version of React Native, 0.70.0. This version comes with several improvements like a new unified configuration for Codegen, Hermes as default engine, and full CMake support for Android builds along with a refresh of the documentation for the New Architecture. Read on to learn more!
Weekly Picks
Functions in Kotlin â Functions are used to reuse code very easily. In this article, you will learn how to create your very own functions.
ÂSimple Google Map App - Jetpack Compose âThis blogpost is a step-by-step guide to implement Google Map app using Jetpack Compose components for the Android Maps SDK.
ÂSwitching Fragments With Code - FragmentTransaction is a class that enables us to add and remove fragments programatically. It works with the backstack just like the one activities use. All we need is a ViewGroup to hold the fragments. In this blog. Pete lists the steps required to work with FragmentTransaction instances.
ÂAnimated Balloons With React Native - Animated balloons are a pretty attractive way of engaging with users. They can be used to attract userâs attention by congratulating them inside your app or by simply celebrating something, for instance. In this article, we will explore how to create animated balloons with React Native.
ÂReact - Introducing JSX â JSX stands for 'JavaScript XML' and is a syntax extension for JavaScript. It is used to create DOM elements that are then rendered in the React DOM. Although it looks like HTML, it is actually an XML-like syntax specifically written for use in React. In this blog, you will learn about various JSX concepts.
Tutorial of the week
Writing our first Java code
Where do we write the code? To answer this question, we need to understand that the onCreate
 method in MainActivity.java
 executes as the app is preparing to be shown to the user. So, if we put our code at the end of this method, it will execute just as the user sees the app.Â
We know that to execute the code in a method, we need to call it. We have wired our buttons up to call a couple of methods:Â topClick
 and bottomClick
. Soon we will write these methods. But who or what is calling onCreate
!? The answer to this mystery is that the Android operating system itself calls onCreate
. It does so when the user clicks the app icon to run the app. In Chapter 6, The Android Lifecycle, we will look deeper at this phenomenon, and it will be clear exactly what code executes and when. You don't need to completely comprehend this now. I just wanted to give you an overview of what was going on.
Let's quickly try this out. Switch to the MainActivity.java
 tab in Android Studio.
We know that the onCreate
 method is called just before the app starts. Let's copy and paste some code into the onCreate
 method of our app and see what happens when we run it.
Adding message code to the onCreate method
Find the closing curly brace }
 of the onCreate
 method and add the highlighted code shown next. In the code, I haven't shown the complete contents of the onCreate
 method but have used âŚ
 to indicate some lines of code not being shown. The important thing is to place the new code (shown in full) right at the end but before that closing curly brace, }
:
@Override
protected void onCreate(Bundle savedInstanceState) {
âŚ
âŚ
âŚ
// Your code goes here
     Toast.makeText(this, "Can you see me?",
                    Toast.LENGTH_SHORT).show();
       Â
     Log.i("info", "Done creating the app");
}
Notice that the two instances of the word Toast
 and the word Log
 are highlighted in red in Android Studio. They are errors. We know that Toast
 and Log
 are classes and that classes are containers for code.
The problem is that Android Studio doesn't know about them until we tell it about them. We must add an import
 for each class. Fortunately, this is semi-automatic.
Left-click on the red Toast
 code in the onCreate
 method. Now hold the Alt key and then tap Enter. When prompted, choose Import class. Now repeat this process for Log
. Android Studio adds the import directives at the top of the code with our other imports and the errors are gone... read more here.
Â
This how-to was curated from the book Android Programming for Beginners
đ Hit the button to take a deeper dive into the world of Android! đ
Events and Conferences
React India 2022Â Â Â Â Â Â Â
React India is an international conference that provides a platform for developers to share and discuss their insights and experiences with React! It provides developers from India an opportunity to meet, listen, and network with React Developers and Open Source Contributors all around the world!
Â
When: September 22nd-24thth, 2022
Â
WeAreDevelopers Java Day
Gain insights on Java with five live streamed expert talks! Tune in to learn about the advantages and challenges of splitting our more complex applications with microservices. Right after that, we will jump into a live coding session comparing Java and Kotlin (and showing the simplicity of using Kotlin over Java to do some daily tasks). And last there will be some testing and how to clean those anti-patterns up! As always, we selected a bunch of relevant topics to give you some insights into whatâs going on in modern Java programming.
When: September 21st , 2022
Â
JCON 2022
Join the JCON community of 2,500+ Developers from 77 Countries! Learn from the experts, and be inspired by your peers.
When: September 20th-23rd , 2022
Â
See you next week!