What To Expect From Android 11 As A Developer And How To Try It


Android 11: new features with Android Studio emulator tutorial
Overview the key features and changes, set up your Android Studio, and get started developing mobile apps targeting Android 11.

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
    Android 11 - Bubbles
  • 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
      Android 11 - Conversation Notification
  • 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

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 and ACTION_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 to Files & 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 and java.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 sending RTM_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:

  1. Download and install Android Studio from the following page
  2. Open Android Studio, then click Tools > SDK Manager
  3. Select Show Package Details in the SDK Platforms tab
  4. Select one of the options inside the Android R Preview section, Google Play Intel x86 Atom System Image for example
    Android 11 - 1 - SDK selection
  5. Switch to the SDK Tools tab, select the latest version of Android Emulator
    Android 11 - 2 - Emulator selection
  6. Click OK to start the installation
    Android 11 - 3 - Confirmation
    Android 11 - 4 - Progress
  7. After the end of the installation, create a new virtual device by selecting Tools > AVD Manager > Create Virtual Device...
    Android 11 - 5 - Create virtual device
    Android 11 - 6 - Create virtual device - select system image
  8. Double-click the created virtual device to launch it
    Android 11 - 7 - Your virtual devices
    Android 11 - 8 - Emulator launched

Build tools setup

To install the Android 11 Preview SDK

  1. Open Android Studio, then click Tools > SDK Manager
  2. Select Android R Preview in the SDK Platforms tab
  3. Select Android SDK Build-Tools 30 (or higher) in the SDK Tools tab
  4. 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'
    }
    ...    
}


Author Image

Soufiane Sakhi is an AWS Certified Solutions Architect – Associate and a professional full stack developer based in Paris, France. He is the creator of Simply-how.com, the My Route Directions Android app, and many open source browser extensions such as YouTube Playlist Helper and Feedly filtering and sorting.