What To Expect From Android 11 As A Developer And How To Try It
Introduction
Android 11 is the current version of the widely used mobile operating system by Google released on September 8, 2020.
The release name is no longer based on desserts since Android 10.
The release was slightly delayed because of the COVID-19 (coronavirus) pandemic.
It comes with fewer user facing features compared to previous versions, but with many developer-oriented enhancements.
Key features and changes
- Bubbles: a floating widget that makes it easy to multi-task. It can be used by messaging apps to easily access several conversations
- Highlighted conversations area in the notifications section with added functionality:
- Multiple choices are displayed after long-pressing a conversation notification
- New notification design with an avatar combined with the conversion app's icon
- Ability to pin apps to the top of the Android Sharesheet
- Turning on airplane mode no longer disconnects Bluetooth audio connections
- Users can insert images and other rich media content into quick replies
- Improved support for 5G
- Improved privacy and security
- Enhancements for company-owned devices: easier management, separate work and personal tabs in Settings
- Permission dialog visibility behavior change:
- Tapping Deny twice for a specific permission during an app's lifetime of installation on a device implies "don't ask again"
- The system also defines behavior for responding to actions that emulate a tap of the Deny option:
- If the user presses the back button to dismiss the permission dialog, this doesn't count as a "deny" action
- If the user is taken to system settings from your app using requestPermissions() and then presses the back button, this does count as a "deny" action
Privacy
- One-time permissions: temporary app permissions can be granted by users to allow access to location, microphone, and camera
- Background location access: apps can no longer directly request all-the-time access to background location
- Scoped storage enforcement: apps can no longer run under the legacy storage model (using
requestLegacyExternalStorage
)
API changes
- Several methods added to the MediaStore API to perform batch media file operations (
createWriteRequest
,createFavoriteRequest
,createTrashRequest
,createDeleteRequest
) - The
READ_EXTERNAL_STORAGE
permission allows access to media files using raw file paths - The
ACTION_OPEN_DOCUMENT_TREE
andACTION_OPEN_DOCUMENT
intent actions can no longer be used to allow the user to select files from the following directories and their subdirectories:Android/data/
,Android/obb/
- The
Storage
runtime permission UI name is changed toFiles & Media
- Secure sharing of large datasets using data blobs. Access can be granted to a specific set of apps on a device by package name specification, by having the same key signature, or to all apps on the device with the allowPackageAccess, allowSameSignatureAccess and allowPublicAccess methods respectively
- The NDK ImageDecoder API provides a standard API for Android C/C++ apps to decode images directly
- Added the ability to dynamically supply additional resources and assets or modify the values of existing one with the new API classes ResourcesLoader and ResourcesProvider
- The
android.icu
package is updated to use version 66 of the ICU library, which bring support to Unicode 13 andjava.util.Locale
- Neural Networks API (NNAPI) enhancements
- Android Emulator camera capabilities improvement with RAW capture, YUV reprocessing, Level 3 devices and Logical camera support
- Mute notification sounds and vibrations during active capture with setCameraAudioRestriction
- Wi-Fi Passpoint enhancements with Expiration date enforcement and notification, FQDN Matching, Self-signed private CAs; Wi-Fi Passpoint allows apps to silently perform authentication and connect to secure Wi-Fi hotspots
- Wi-Fi Suggestion API expansion with Passpoint networks integration, Analytics APIs and better network management
- Better debugging for JobScheduler API calls limits
- The device's MAC address won't be accessible to non-privileged apps using
getifaddrs()
,NetworkInterface.getHardwareAddress()
, or when sendingRTM_GETLINK
netlink messages - Restriction of the non-SDK test APIs (annotated with
@TestApi
)
Installation
Using a physical device
System images for a variety of Pixel devices are available to develop and test Android 11 apps. These devices include the Pixel 2, 3, 3a, or 4 along with their XL
variety.
The installation on these physical devices requires a full flash, which implies that all the device's data will be wiped.
To download the appropriate Android 11 system image and flash your device, follow the instructions on this Downloads page.
Using an emulator
An emulator for Android 11 can be set up using Android Studio:
- Download and install Android Studio from the following page
- Open Android Studio, then click
Tools > SDK Manager
- Select
Show Package Details
in the SDK Platforms tab - Select one of the options inside the
Android R Preview
section,Google Play Intel x86 Atom System Image
for example - Switch to the
SDK Tools
tab, select the latest version of Android Emulator - Click OK to start the installation
- After the end of the installation, create a new virtual device by selecting
Tools > AVD Manager > Create Virtual Device...
- Double-click the created virtual device to launch it
Build tools setup
To install the Android 11 Preview SDK
- Open Android Studio, then click
Tools > SDK Manager
- Select
Android R Preview
in the SDK Platforms tab - Select
Android SDK Build-Tools 30
(or higher) in the SDK Tools tab - Click OK to start the installation
To begin using new Android 11 APIs with a Gradle project, open your project's build.gradle
(module level), and set the following values inside the android
properties: compileSdkVersion 'android-R'
, targetSdkVersion 'R'
.
The resulting file should look like this:
...
android {
compileSdkVersion 'android-R'
defaultConfig {
...
targetSdkVersion 'R'
}
...
}
Soufiane Sakhi is an AWS Certified Solutions Architect – Associate and a professional full stack developer.