Android Jetpack Rockets Forward With Cameras and Biometrics
The speed and ease of development have been core focuses of the Android platform practically since day one. Right from the beginning, Google set out to lay the foundation for how to support the greatest number of devices in the easiest possible manner on already available phone hardware. Last year at Google I/O 2018, Google laid the foundation for the next generation of Android support libraries with Android Jetpack. At Google I/O 2019, Google is taking their support libraries to the next level with a series of new releases from an easier to use Camera library with CameraX to a simple way to integrate Biometric Authentication of the user’s choice with Biometrics Prompt.
The Kotlin programming language has quickly grown in popularity since its debut. After declaring that Kotlin will receive first-class support from Google, Google is now announcing that Android development will increasingly become Kotlin-first. Many new Jetpack libraries will be offered first in Kotlin. To help developers get started with Kotlin, Google encourages developers to attend Kotlin/Everywhere events and take Udacity courses.
While Camera2 was a major step forward in power, ease of use, and standardization for camera functionality across Android, it still is incredibly complex with varying features across different devices. This may be fine for a dedicated camera application developer (although even some billion dollar companies struggle with it), but it is more in depth than what the average app wants to include. Most camera applications are fine with targeting one standardized API and allowing the device to do the heavy lifting, and CameraX makes this possible. With full backward compatibility on any Camera2 device all the way back to Android Lollipop, CameraX provides a simpler library for developers to target and allows them to maintain backward and forward compatibility with any current or future devices that support Camera2 or any future successor that CameraX integrates with. And that’s not just for base features either. CameraX takes full advantage of any functionality that Google has integrated between Camera2 and CameraX, including HDR, Portrait Mode, Wide Angle, Single shot multi-cameras, and even Google’s critically acclaimed Night Mode.
Biometrics Prompt takes the complexity out of Biometric Authentication, removing the need to interface directly with any of the security features. A developer just needs to call Biometrics Prompt, and it’ll hand the request over to the system’s default biometric authentication system, whether that be fingerprint, iris, face, or something else entirely. This Android Jetpack library will become increasingly useful as new innovative biometric authentication methods are implemented in phones, making it simpler to support the system that users choose now and in the future.
LiveData and Lifecycles w/ coroutines
Jetpack’s new Lifecycle and LiveData KTX will let you use Kotlin coroutines that are lifecycle-aware so you can support your common one-shot async operations. Jetpack will handle further handle concurrency in a simpler manner by “offering coroutine scopes tied to lifecycles, coroutine dispatchers that are lifecycle-aware, and support for simple asynchronous chains with the new LiveData builder.”
Android Jetpack aims to make it easier to ensure that your apps perform the way you want them to, and it will now give you the necessary tools to test for performance with Benchmark. This library allows you to examine your app’s latency, database queries, view inflation, and RecyclerView scrolls all without leaving Android Studio.
Security is one area where it is easy for even large developers to slip up, and this library aims to make it less of a chore. From managing hardware-backed keystores to generating and validating keys, the Security library takes the focus away from boilerplate, and allows you to put it into actually securing your application.
The Android Jetpack Enterprise library simplifies integrating with Enterprise Mobility Management providers, allowing an app to send keyed app states without having to worry about matching managed configurations across versions.
ViewModel with SavedState
ViewModel and SavedInstanceState have made it easier to recover from crashes without loss of UI configuration data, but still required a fair amount of boilerplate code. By integrating SavedState into ViewModel, Google has stripped that boilerplate away and made using both much easier.
ViewPager made it easier to implement horizontal page scrolling in Android apps. ViewPager2 is the next evolution, adding support for vertical scrolling and RTL layouts.
Android for Cars
Android for Cars ties in heavily with Google’s current push forward with the Android Automotive OS. It enables you to create a car-designed version of your app for use by your users on the Android Auto head unit (or phone) of their choice.
Background tasks can be difficult to properly implement. Workmanager takes the frustration out of it by handling the background scheduling for you in a way that will behave nicely with the device at hand.
No, not physical navigation. Navigation through your application! The Android Jetpack Navigation library provides guidance on how to lay out movement through your application in order to avoid crashes, dead ends, and unpredictable navigation.
Saving the best for last, Google also is announcing an early preview of Android Jetpack Compose, an unbundled toolkit. Building on what Google is learning from Flutter, Compose aims to bring a more reactive and declarative programming approach to Kotlin UI development with the same principles that made Flutter a community favorite. Compose is being built with the following core principles:
- Including the benefits of Kotlin – concise and interoperable with Java.
- Fully declarative for defining UI components. The framework handles UI optimizations and view hierarchy updates under-the-hood – all you have to do is describe your UI as composable functions.
- Build custom widgets with reusable building blocks.
- Works with existing views.
- Support Material Design out of the box.
- Support tools like Live Preview and Apply Changes.
Google won’t be releasing a beta or even alpha of Compose, but the company will open source the entire project so developers can check it out as it’s being made. If you encounter any bugs during early testing, you can file bugs here.
Want more posts like this delivered to your inbox? Enter your email to be subscribed to our newsletter.