New guidelines for accessing background location in Android
We’ve got 2021 and if you are an Android Developer you need to know a few things that are going to change really soon.
There are new guidelines for using background location in Android apps. If you want to use this permission in your app you’ll need to submit a special Permissions Declarations Form in Google Play Store.
- App published before April 16, 2020 – Submit a compliant version of your app by March 29, 2021
- Apps published after April 16, 2020 – Submit a compliant version of your app by January 18, 2021
I decided to write this blog post because the whole process of preparing your app for this is not obvious. It took some time for me to understand how Google wants you to prepare your app for this and what steps you need to take before sending the form in the Play Store.
Google Play Policy – Declared permissions and in-app disclosures
Start from reading official docs and just take a look at video posted at Android Developers channel.
Before sending the form
- Check if you really need this permission. In my opinion in most cases you don’t need it. Setting GPS permission to “While app in use” should work for most apps.
- In my case that permission was needed for one special feature in the app. Also I needed to add it because of the change of using foreground services in Android 11 (read my previous blog post: Restrictions to background location and foreground services in Android 11)
- Make sure you’ve added prominent disclosure and runtime permission (with user consent)
Usage of the location should be clear for user but we’ll stop here because in most cases your app can be rejected because of missing proper disclosure - Prepare a video of yourself app showing the usage of that feature. Prominent disclosure should be also visible on your video.
Location permissions form
Here’s the form. Prepare a short description of your app and how you want to use background location access and why you need it.
If something is wrong you’ll get an answer from Google the same day (of course this can vary). We tried that in November 2020 (maybe in 2021 when you got the deadline the approval/rejection time can be longer).
Let’s talk about rejections. I sent this form a few times (I was sure I prepared my app properly but there was always something missing). It looks like we didn’t get the clear point how this should be done. I contacted many other developers also trying to fill that form and they’d also been rejected
Rejections
First attempt
In our case, using background location is needed for one feature. We don’t need a background location from all users, we also don’t want to ask for a background location if we don’t need to.
So we decided to do it like this:
- Add special disclosure before turning on feature that needs to use background location
- We added a new fullscreen fragment showing all the info – why we need that permission and how it is used.
- We added suggested flow to ask for Background Location permission
- We don’t ask for background location permission if we don’t have to.
For us it was something obvious and we were pretty sure this would work. We don’t ask for that permission if we don’t need to use it.
Decision: REJECTED
Our review team must be able to verify the feature’s functionality in your app. If your feature is not visible to the user then you must demonstrate its functionality in your submitted video. Your video should show the in-app feature’s functionality using location in the background and how a user would trigger the prominent disclosure, runtime permission (with user consent), and the declared feature. If your feature’s functionality is not directly visible to the user, then you will need to show us its functionality in a video showing the in-app experience (e.g. notifying the user of a fraud alert). Please modify your video to demonstrate the declared feature for which you are requesting access to location in the background, and resubmit your declaration form via the Play Console |
It wasn’t clear for us what was wrong. We understood that the video wasn’t right and using the feature wasn’t obvious.
Because the feature we have in our app was strictly related with this Android 11 change: Restrictions to background location and foreground services in Android 11 we thought the Google Play Store Team didn’t understand our case.
We recorded new, resubmitted the form again with a new video but the answer was the same. Status: REJECTED
After sending appeal to our case we got more detailed rejection status.
Prominent disclosure not foundYour app must display a prominent disclosure through a pop-up alert before your app’s location runtime permission. Based on our review, a prominent disclosure did not appear before the runtime permission. Please add a prominent disclosure before the runtime permission.Remember, your prominent disclosure must:Appear before your app’s location runtime permission.Include at least the following sentence, adapted to include all the relevant features requesting access to location in the background in the app that are readily visible to the user: “This app collects location data to enable [“feature”], [“feature”], & [“feature”] even when the app is closed or not in use.” If you extend permitted usage to ads, please also include: “This data is also used to provide ads/support advertising/support ads.”Include any other details necessary to make it clear to the user how and why you are using location in the background. While additional content is permitted, it should not cause the required content to not be immediately visible. |
It was missing the point. But let’s stop here for a while. I talked with many devs trying to pass this location form and in most cases the proper way of showing prominent disclosure was the problem. This reply from Google is telling exactly what you need to do.
So let’s get back to our case. This approach in our case was WRONG:
- Home screen. We didn’t ask for background permission if we didn’t have to.
- There was one feature that could use standard location access (while the app is open). We didn’t ask for background permission so there was no disclosure about it.
- When the user was trying to use a feature that is using background location access – we created a separate fragment showing disclosure, telling him why, we used proper scope for asking for this permission (recommended by Google for Android 11).
- User approved this permission for this feature – the feature is ready to go.
As I know, many devs were trying to use it just just like that. You won’t be accepted if you have scope like this in your app.
You should do something like this
To pass Google Play Store review you need to have prominent disclosure before asking for ANY location access. That’s the change we made. We left the second consent screen before turning on features that need to use background location access (we want to be transparent for users).
In the disclosure we wrote how we use location in general and we mentioned features. We said that most features don’t need to use background location and you won’t be asking for it if we don’t need it but you should be aware that if you want to use (in our case) GPS recording feature – you need to allow background location permission. And later we’ve got recommended scope for asking for it.
Keep in mind your use case can vary. If you are using ads – you need also put this information in that disclosure (we don’t use ads or Advertisement ID).
- Verify if you really need background permission access. You can still use foreground service for location (if you are not starting it from the broadcast receiver or any other background process). In that case foreground service is becoming background service and you need this permission.
- Show proper dialog telling how you use location in your app. Do it always before asking for any location permission.
- Remember about using proper scope for asking for background location (especially for Android 11)
- Record a short video (required by the form) showing your feature. Disclosure dialog should be also visible on the video.
TL;DR
Summary
We started working with the form in October 2020 so it was just after Google released it. Like I said before, because this is manual review, this process may vary for you. Your use case can be different but many developers were missing proper disclosure.
Also don’t forget to look at official docs that are updated.
If you find this article useful, ping me on Twitter @adekk and leave a comment. It’s always great to have feedback from readers.
This article was also posted at Medium.