How Android 11 Will Impact Your App

In this article, we’ll look at the latest version of Android: Android 11, which sometimes goes by the name “Android R”.

Android 11 follows the precedent set with Android 10 in that it doesn’t have a dessert-themed codename, or any kind of codename.

While the new version of the operating system has incremental, rather than major changes and isn’t likely to break your apps, there are a number of technical and logistical issues that app developers should take into account.

How Big is the Android 11 Market, Anyway?

Distribution of Android Versions

Pictured above is the graph showing the distribution of Android versions at the start of October 2020. It’s based on worldwide active user data from the Play Store and appears in Android Studio’s “Create New Project” wizard.

You can see that Android 10 has yet to capture 10% of the user base, and Android 11 doesn’t even appear in the graph. You might be tempted to put off any effort to upgrade your app to Android 11, but that’s not a good idea.

While Android 10 makes up only 8.2% of the total Android market, that’s still a market of 205 million users, most of whom tend to own the latest devices and are far more likely to invest in apps. It was also the fastest-adopted version of Android ever, having grown to 100 million users in five months.

The adoption rate of new versions of Android has been steadily speeding up with each new version, as this graph from the Android developer site shows:

Graph: Adoption rate of new versions of Android

If the pattern holds, you’ll have time to update your apps for Android 11 — but you’d better hurry!

 

1. OEMs Are Releasing New Android Versions Faster

Graph: Average wait of adoption of new Android OS by device manufacturers

When a new version of Android is released, phone and tablet manufacturers have to customize it to their particular devices, test their customized OSs, and in some cases, provide the update to carriers. This process has traditionally taken months, but over the past few versions, it has been speeding up.

With Android 8 came “Project Treble,” a re-architecting of the OS’ framework so that Android OS-specific code lives in a separate layer from OEMs’ hardware-specific code. This separation of concerns greatly reduces the time required for OEMs to adapt new versions of Android to their devices — in some cases, by 90 days.

You’ll need to factor this faster time-to-market when making plans to support Android 11.

 

2. Changes to Toasts

If you use toasts to provide notifications and reminders to users, you should be aware that there are a number of changes to how they work in Android 11.

  • Text-only toasts can no longer have custom margins or gravity. The setGravity() and setMargin() methods still exist, but as of Android 11, they have no effect on text toasts.
  • Custom toasts — that is, toasts with custom layouts — can no longer be displayed if their app is in the background. An app in the background can still display standard toasts, and an app in the foreground can still display a custom toast.
  • A new callback object, Toast.Callback, has been added. It provides two methods that allow you to specify actions when the toast is shown, and when the toast is hidden.
  • The toast setView() method, which specifies the view to be shown, is deprecated in Android 11. It still works, but don’t expect it to be available in upcoming versions of Android.

 

3. Android Location Support

Android supports two kinds of location:

  1. Foreground location, for features that require location information once, or for a short, defined amount of time. Examples include turn-by-turn directions for navigation, or reporting the user’s current location.
  2. Background location, for features that require an ongoing update of the user’s location or use the Geofencing API. Examples include a monitoring app that tracks the user’s location as they move about or an IoT app that turns on the lights when the user arrives at home.

Android 11 enforces the best practice of performing incremental requests for location permissions — first for foreground location and then background location. This approach gives users a better understanding of which app features use background location.

Prior to Android 11, when an app requests permission to use background location, the permissions dialog includes an option named “Allow all the time”. Selecting this option gives the app background location access.

This has changed in Android 11, where the system permissions dialog no longer includes the “Allow all the time option”. Instead, the app should show a label for the option in Settings that grants permission for using background location, which takes the user to this screen:

Android 11 location permission dialogue

Note that in Android 11, if the app requests foreground and background location permission at the same time, the system ignores the request and doesn’t grant either permission to the app.

 

4. Scoped Storage is Now Universally Enforced

Until Android 10, apps with access to external storage had access to its entire filesystem.

This approach, which is similar to the way desktop applications work, makes it possible for different apps to use the same data. For example, it allows you to take a photo with a camera app, edit it with a photo-editing app, and then share it with a social media app.

One problem with this approach is that it raises all sorts of security issues. You don’t want a social media app to be able to read your bank app’s files!

Another problem is clutter. Unlike data in private storage, which is deleted when you remove the corresponding app, deleting an app doesn’t delete the data it wrote to shared storage.

These issues led to the creation of scoped storage, which limits the scope of apps’ access to external storage. Instead of unfettered access to external storage, each app that uses external storage creates its own directory, for which it automatically has read and write access.

This directory is divided into two areas:

  1. One for media files (images, audio, and video)
  2. One for non-media files (everything else)

 

Each app has unrestricted access to their own directory. An app that wants to read and write media files from other apps’ directories will require the permission to do so. To read and write non-media files from other apps’ directories, an app can use the Storage Access Framework API.

When scope storage was introduced in Android 10, there was considerable pushback from developers, who had grown used to unrestricted access to the external storage file system. Google responded by making use of scoped storage optional for apps that target Android 10 to help developers acclimate to the idea.

However, this reprieve ends with Android 11. Apps targeting Android 11 that use external files must use scoped storage.

 

5. Changes to Permissions

Android 11 comes with some changes to the permissions system to better protect users’ privacy.

The new OS the option of one-tme permissions, where the user can choose “Only this time” when the app requests permission to use the camera, location, or microphone. As the name implies, this permission is granted for only as long as the app is running. The next time the user runs the app, it will present another request for permission.

Android 11 also features permissions that auto-reset for apps that haven’t been used in a few months. The operating system automatically revokes permissions to use the camera, location, or microphone in these apps. The next time the user runs one of these apps, the app will present another request for permission.

While you should be aware of these changes to the permissions system, if your app already follows the recommended practices for requesting runtime permissions, you should have to make any changes to it.

 

6. Shared Cached Datasets

Android 11 introduces a feature that caches large datasets — the kind that would be used in machine learning and media playback — that might be used by more than one app.

The system does this by caching these large “blobs” (short for “binary large objects”) and making them available to multiple applications. This reduces the bandwidth and space used.

Your app can access and control access to these blog using the BlobStoreManager API.

 

7. Support for Different Screen Types

Android 11 provides APIs to support screen types that go beyond the plain rectangular surface.

One of the newly-support screen types is the waterfall display, which wraps around the edge of the device as shown below. The part of the screen that goes around the edge is called a waterfall inset:

Android 11 Waterfall Inset

Android treats water displays as one with display cutouts. This means that you can use the DisplayCutout class’ getSafeInset methods to determine which parts of the screen are the waterfall inset.

Android Folding Phones

Folding phones have received a lot of tech media attention lately; they’re also getting support from Android. Android 11 provides a number of methods and properties to report the folded state of the phone, including a sensor event that monitors the folded state of the phone, as well as a value that reports the angle between the two segments of the device.

 

8. Application Signing

If you’ve been signing your APKs using signature scheme v1, note that Android 11 does not support it. The minimum version signature scheme you should use for Android 11 APKs is v2, and you should really use the latest version, v4.

 

Conclusion

While the changes we’ve listed are ones that we believe are most likely to affect your app development, this is by no means a complete list. The Android ecosystem covers a wide array of vendors and devices, which means that each new version includes a list of changes too long to fit into a single article.

To see a complete list of all the changes introduced in Android 11, we strongly recommend that you review the Android 11 documentation on the Android Developer site.


Tags:
Team Big Fish

Team Big Fish

At Big Fish we help healthcare companies innovate through secure, custom mobile app design and development. Please visit the Let's Talk page if you’d like more information about hiring our team.
Follow me on Twitter