Yesterday I did a lot of tests to figure out how things worked regarding permissions and background location (full report here). It's clear that background permission is more difficult to get approved since API 29.
How do we request permission for background locations in API 29 and above?
I found that API 29 got a new permission: ACCESS_BACKGROUND_LOCATION, but just requesting it doesn't solve the problem. I quote from the documentation:
The documentation mentions setWhitelistedRestrictedPermissions, and looking at that page makes things really complicated for me.
(I also have a very vague memory about me reading somewhere that developers need to list some dangerous permissions when uploading the app in the console, and Google manually need to grant access to permissions if they think your use-case sounds reasonable. I'm not sure I remember that correctly, and I'm not sure that it's relevant to this situation.)
How do we request permission for background locations in API 29 and above?
I found that API 29 got a new permission: ACCESS_BACKGROUND_LOCATION, but just requesting it doesn't solve the problem. I quote from the documentation:
Allows an app to access location in the background. If you're requesting this permission, you must also request either ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION. Requesting this permission by itself doesn't give you location access.
This is a hard restricted permission which cannot be held by an app until the installer on record whitelists the permission. For more details see PackageInstaller.SessionParams.setWhitelistedRestrictedPermissions(Set).
The documentation mentions setWhitelistedRestrictedPermissions, and looking at that page makes things really complicated for me.
(I also have a very vague memory about me reading somewhere that developers need to list some dangerous permissions when uploading the app in the console, and Google manually need to grant access to permissions if they think your use-case sounds reasonable. I'm not sure I remember that correctly, and I'm not sure that it's relevant to this situation.)