Permission Updates in Android 11

If you’re a developer interested in being on the cutting edge of mobile betas, you’ve probably downloaded Android 11’s developer beta and started poking around. And if you’re not quite that ambitious you still have plenty of time before you need to adopt changes into your apps. But it’s still good to know what changes are coming that you’ll need to prepare for.

Getting Android 11

Android 11’s first public beta was set to come out June 6th, but as of yesterday this has been postponed. A public beta means anyone with a compatible phone has the option to update their software and test out the new version. This same option is already available with the developer beta, but it also requires flashing your phone.

Flashing can be intimidating if you’ve never done it (and dangerous as you’ll lose any data that’s not backed up). That may sound harsh, but it’s really not too complicated of a process. You just need access to the system image for the version of software your phone is updating to, and that’s available on developer.android.com. I’ll be writing a post about how to flash phone shortly, so stay tuned if you’re interested.

Permission Changes

There are a number of updates coming with Android 11, but the main one this post is focused on is permissions. The theme as with most Android updates over the years being more privacy and control into the hands of users. Users are gaining more granular control over an app’s access to the phone’s location, camera, and microphone. More privacy is never a bad thing.

The biggest change is the introduction of one-time permissions. In the past users have been given two options, either allow an app to use things like their location or don’t. Unfortunately this dichotomy allows apps that have been granted permission to use that permission in the background even if that’s not what you prefer. Now the traditional permission request will have three options: “Only this time”, “While using the app”, or “Deny”.

The last of these is the same as always, whereas now the user has more control over time intervals an app can use your data. If you need to grant your location or record your voice for a feature in an app, you can still rest assured it’s not being accessed when the app is in the background. Additionally now if a user selected “Deny” more than once the app will automatically apply the old “Don’t ask again” setting.

Development Impacts:

More user control is certainly a good thing, but how should developers adapt to account for the changes? Well now if an application wants access to your location all the time, it has to be granted within the system settings screen. It’s no longer an option in the permission dialog.

To account for this change we need to begin by adding the ACCESS_BACKGROUND_LOCATION and either ACCESS_FINE_LOCATION or ACCESS_COARSE_LOCATION permissions in the manifest file. Then when we need to access the user’s location we request either FINE or COARSE using the requestPermissions method. Note that this is a request before requesting access to background usage. Otherwise no dialog will appear at all.

After this is granted, we’ll have to add a custom dialog explaining why we would want access to the user’s info in the background. And with this dialog add an action to take the user into the system settings. It’s a more convoluted process to get the permission at all times, but that’s the whole idea. This way a user will never give universal access unless they are completely aware of it and know why they’re doing so.

Differing versions:

This isn’t a HUGE change, but it’s definitely one you need to account for. And as always we must account for the fact not everyone is running on the same Android version. That sure would make development simpler, but it’s just not feasible since OS roll outs take time.

Android’s developer website shows a table for which permissions you’ll need to request depending on which version you’re running (11, 10, or lower than 10). Depending on the version you’ll need to request either a different type of permission or request multiple types at differing times. Here’s the chart:

Whether you’re updating a legacy app or you’re creating a brand new one, it’s crucial you account for a positive user experience. And that starts with a good UI, along with respecting the user’s privacy. A combination of the two is a surefire way to get good reviews in your apps!

If you liked this post and want to see others like it check out FreeMobileTutorials.com

I’m a self taught Android, iOS and VR developer fascinated with the world of mobile. I’m passionate about learning new technologies by way of teaching others.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store