I have an app that gets location updates on a foreground service, even when the screen is off. On Android 10 downwards it works perfectly fine, I've created a foreground service declaring the permissions on the Manifest file and it has foregroundServiceType="location". For testing purposes, I've created a POST request where I send the location updates to my computer so I can see when the location is being updated even when the screen is off.
So far everything is fine. However, on Android 11, I don't receive location updates when the screen is off. I've already read resources like this question on Location Updates on Android 11 from StackOverflow telling me that besides getting the ACCESS_FINE_LOCATION, I also need to get the ACCESS_BACKGROUND_LOCATION separately, just so I can get location updates. But that's not what I'm seeing in practice, even though when I ask for ACCESS_BACKGROUND_LOCATION in a different moment as dangerous permission. I only get location updates while my screen is on (it doesn't matter if my app is opened or not). The moment I turn off my screen, I don't receive any updates on my location. Am I missing any extra detail here? Is there anything else I should be doing for receiving location updates when the screen is off on Android 11?
So far everything is fine. However, on Android 11, I don't receive location updates when the screen is off. I've already read resources like this question on Location Updates on Android 11 from StackOverflow telling me that besides getting the ACCESS_FINE_LOCATION, I also need to get the ACCESS_BACKGROUND_LOCATION separately, just so I can get location updates. But that's not what I'm seeing in practice, even though when I ask for ACCESS_BACKGROUND_LOCATION in a different moment as dangerous permission. I only get location updates while my screen is on (it doesn't matter if my app is opened or not). The moment I turn off my screen, I don't receive any updates on my location. Am I missing any extra detail here? Is there anything else I should be doing for receiving location updates when the screen is off on Android 11?