Since Google I/O kicked off last week our Android team have been busy playing with all the new features and releases. One of which is improved functionality for Android Jetpack. So we asked our Android developer Martha to explain what using Android Jetpack for app development means for us and our clients. 

What is Android Jetpack?

Essentially, Android Jetpack is a set of “unbundled” libraries, tools and guidance which improves the quality of Android apps as well as enables fewer crashes and less memory leaked with backwards-compatibility. It combines the existing Support Library as well as the Architecture Components which were introduced at Google I/O 2017. The best part of Android Jetpack for app development is that the libraries (Architecture, UI, Foundation and Behaviour) are individually adaptable but are built to work together as well, so you can run the apps on different versions and you can adapt each library separately. Therefore, you can add the components you need in your existing code. As a result, the testability is improved and you can create high quality apps. Moreover, Android Jetpack supports Kotlin integration, which helps us create apps with less code.

What’s new?

At Google I/O 2018 5 new components have been announced: WorkManager alpha release, Navigation alpha release, Paging stable release, Slices alpha release and Android KTX (Kotlin extensions) alpha release.

WorkManager

The WorkManager component is a powerful new library that provides the ability to specify deferrable, asynchronous tasks and when they should run. You can create a task, choose appropriate circumstances for it and hand it off to WorkManager to run at an appropriate time. Further, the task is still guaranteed to run, even if your app is force-quit or the device is rebooted. We don’t need to figure out the device’s capabilities or check its API; the WorkManager will choose the best option. Moreover, you can show UI (User Interface) for the task’s status with the use of LiveData. One of the advanced features is that you can also set up a chain of tasks; tasks are queued up one after the other and are implemented one at a time.

Navigation

The Navigation component is a framework for structuring the UI for your app while using the most fitting architecture. In addition, you have access to the Architecture Components such as Lifecycle and ViewModel. Furthermore, Navigation handles the FragmentTransactions. While it allows you to declare the transitions, it builds the correct behaviour (moving back and forth), supports deep links and creates the best connection between Navigation and the UI widgets.

Paging

The Paging component simplifies the process of loading and presenting large data sets in a fast speed in the app’s RecycleView. It can load data either from the local database or from the network, or even both, and you can define yourself how the data gets loaded. It is also compatible with Room, LiveData and RxJava. The biggest perk of the Paging component is that it doesn’t consume as much as network bandwidth as it used to, uses fewer system resources, and the response is quick even when the data is being updated or refreshed.

Slices

The Slices component consists of UI templates that can display content from your app from within Google Search app and now in the Google Assistant as a result of search. Slices support live-data, scrolling content, inline actions, and deep-linking into your app. Slices can also contain interactive controls like toggles, and sliders. With Slices, you can include text, images, videos and/or interactive controls that allow users to see your app as a recommendation to their needs. For the last part we will also need to use App Actions. It is a new way to make your app’s capabilities and content more accessible, so that people can easily get to it at the right moment. App Actions will appear to users based on usage and relevance, across multiple Google and Android surfaces, such as the Google Search App, the Play Store, the Google Assistant, and the Launcher. Moreover, we’re now able to build a Conversational Action by using a variety of Assistant-enabled devices, e.g. speakers and smart displays.

Android KTX

The Android KTX component is a set of Kotlin extensions. It improves the efficiency of Jetpack and the Android platform APIs for Kotlin use. Its purpose is to make Android development easier, more concise and pleasant by taking advantage of Kotlin’s existing features such as extension functions/properties, lambdas, named parameters, and parameter default values. The Android Runtime (ART) in Android P has been upgraded, so that apps built in Kotlin will run faster. It is also worth mentioning that the number of developers using Kotlin is growing each month; currently it is 35 per cent. We’ve been building apps in Kotlin for a while now and already seen huge difference it makes to app development.

What’s new in Android Studio 3.2?

Android Studio 3.2 includes new tools for Android Jetpack such as the Navigation Editor and new tools for code refactoring. In addition, this release includes build tools to create the new Android App Bundle format, Snapshots in the Android Emulator for fast start time, new R8 optimiser for smaller download and install app code size and a new Energy Profiler to measure app impact on battery life.

Since the Android Support Libraries are now part of Jetpack, we need to refactor the old ones to a new Android extension library whose namespace is androidx. This Canary version provides help for migrating an existing project into the new Library while the Android Studio will automatically convert the project’s dependencies.

So what does Android Jetpack mean for App Development?

In conclusion, the developer community has grown dramatically the last couple of years and the latest news from Google I/O shows that they took this seriously. All of the new releases and libraries for Android are aiming on improving both the developer experience and the user interactions. It is a very important investment which will increase developer productivity as well as all the other benefits listed above. By paying attention on the developers’ feedback, they have managed to make the process of building apps faster and easier. Android Jetpack for app development ultimately leads to smarter, user-friendly apps. Considering that the apps will now also be able to expand their usability into other devices besides smartphones and tablets, the most exciting part for the developer community will be the new opportunities which have been created and the introduction of a whole new area of development waiting to be explored!

 

Why use Kotlin for Mobile App Development Sonin Agency