“Expecting an efficient application without knowing the features and capabilities of Android, is like building a house without the appropriate tools, by hand, without help. You just can’t.”
Since the release of Android 6.0 Marshmallow in 2015, Google has created and integrated new features in each new version of Android. Android 9.0 Pie is no exception.
But what do you need to know about the new Android Pie before you start developing it?
These are the main features and capabilities that every Android developer should know:
1. Indoor positioning with Wi-Fi (RTT).
The compatibility of Android 9.0 with the protocol known as Wi-Fi Round-Trip-Time (RTT) allows you to know the indoor positioning of your app.
It works by measuring distances between nearby Wi-Fi access points that have RTT capability. The connection to the access points is not necessary. And in relation to privacy, you should not worry because only phones can determine the distance. Access points do not have this information.
2. Display cutout support.
With the use of the DisplayCutout class, you can now determine the non-functional areas of the new edge-to-edge screens that have display cutout for speakers or cameras.
Additionally, a new screen layout attribute (layoutInDisplayCutoutMode) allows you to place content on the display cutout.
Notifications for Android Pie were improved, generally.
We all already know that, starting with version 7.0, you can respond to a message directly from the notification. That feature is improved in version 9.0, which allows you to have a whole conversation and add images from the notification. You can also use the property setGroupConversation() to identify when a conversation is group or individual.
4. Multi-camera support.
This feature allows you to simultaneously access transmissions from two or more physical cameras. It includes new session parameters that help reduce the delay during the initial capture, supports monochrome cameras and, wait for it, enables support for external USB cameras.
Android 9.0 introduces an updated approach to decoding images with the new ImageDecoder class. You can apply a scale adjustment of the image with setTargetSize(), crop an image using setCrop() and, add custom and complex effects such as rounded corners or circular masks.
With the new AnimatedImageDrawable class provided by Android 9.0, you can draw and display animated GIFs and WebP images. AnimatedImageDrawable works through a rendering subprocess that drives AnimatedImageDrawable animations. The representation subprocess uses a working thread to decode so that the decoding does not interfere with other operations in the representation subprocess.
7. Data cost sensitivity.
Starting with Android 9.0, you can make use of the network status signals provided by the network providers and, through JobScheduler, optimize the handling of network jobs.
You can declare the estimated size of the data, or even specify network requirements. Then JobScheduler manages the job through the state of the network. For example, when a network is congested, JobScheduler could defer large network requests.
Some security improvements that are included in Android 9.0 are:
- Protected Confirmation: When you use this feature, your application will display a confirmation notice that the user must approve in order to perform a confidential transaction such as bank transfers. When the user accepts the declaration, a cryptographic signature is generated. This signature indicates, with a high degree of confidence, that the user saw the declaration and accepted it.
- Biometric authentication dialog: The system provides biometric authentication dialogs. The BiometricPrompt class depends on the system to display the authentication dialog. It also changes its behavior to adapt to the type of authentication chosen by the user. You must use the hasSystemFeature() method to ensure that the device supports FEATURE_FINGERPRINT, FEATURE_IRIS, or FEATURE_FACE.
- APK signature scheme with key rotation: This scheme allows you to include a rotation test record in the signature block for each signing certificate. This capability makes your application sign with a new signing certificate by linking the previous certificates in the APK file with the current certificate. Take into account that previous versions did not allow the change of signature certificate.
- Key decryption only on unlocked devices: This option determines if the Keystore requires unlocking the screen before allowing the decryption of data in development or stored using the specified key. This helps in cases where there is confidential information stored on the disk.
To eliminate involuntary rotations, Android 9.0 adds a new mode that fixes the current orientation, even when the position of the device is modified. Then, the user can activate the rotation by pressing a button in the system bar.
As Android developers, we are always looking for ways to obtain information that will help us make our application more efficient. Android 9.0 gives us a new way to do it. Using the tracking record of the device, you can share a detailed report of your application with your development team. By collecting these traces, you can capture synchronization data related to the processes and subprocesses of your application, and see other types of globally important states. The best part is that you do not need to instrument your code (although it never hurts). You will have a great Android 9.0 application if you keep in mind what Pie is capable of.