I have an app that uses Android’s Geofencing API.
The app has unrestricted battery usage from the device settings…
App info → Battery → Unrestricted
However, my app clearly is getting restricted in some way as the Geofence intents are firing several hours after I have already left the region. Sometimes up to 12 hours delayed.
I have reproduced this problem on two devices and have over 10 users who have reported similar problems. All of the devices are Samsung running Android 12.
This problem only started happening within the last month or so. Everything was working just fine on Android 12 up until recently.
I know that the Geofences are configured correctly as I have been using the Geofencing APIs successfully for over 8 years and I have several other devices that are working properly. I have other devices like a Google Pixel that I am using as a ‘control variable’ that are working great. It is typical to see a 5-10 minute delay - but this delay on Samsung devices using Android 12 is egregious.
I have been digging through the device settings trying to figure out if there is some new, additional configuration that I need to do. Things seem to improve when I turn off the ‘put apps to sleep’ setting.
Settings → Battery and device care → Battery → Background usage limits → uncheck ‘Put unused apps to sleep’.
Ideally, I would have the ability to whitelist just my app by adding it to the list of ‘Never sleeping apps’ but I am unable to add my app to the list of never sleeping apps. It does not show up as option because my app is already set to ‘unrestricted’. So the only option I have is to uncheck ‘Put unused apps to sleep’ which applies to all installed apps - which is not ideal.
- Has anyone else been noticing any problems on Android 12 receiving intents in the background?
- Are there any other settings I should look into?
- Is there any way for me to contact someone at Samsung that works with app developers so I can inquire about what has changed or if this might be a bug?
Thanks!