Forum Xamarin.Android

Android 9 Pie: Location service not updating when screen is off & energy save mode activated!

DominikGanicDominikGanic DEMember ✭✭
edited July 2019 in Xamarin.Android

Hi guys,

I'm working on an app which sends the GPS coords each 15 seconds to my socket server. All works fine so far, when the app is in background even when the screen is locked.

Now, we've figured out, it stops working when the energy save mode is activated.

Note: On Android 8 and below it seems to work fine even when energy save mode is activated. On Android 9.0 Pie the problem occurs. Is it a change due to the new API of Android 9?

Maybe this has a reference to my actual problem:

https://developer.android.com/about/versions/pie/power#battery-saver
https://developer.android.com/about/versions/pie/android-9.0-migration#tya

Power Management update mentions following:
"When battery saver is turned on, the system places restrictions on all apps. This is an existing feature that is improved with Android 9."
Location services may be disabled when the screen is off.
That's exactly what's happening. Can I bypass this?

I've already added the FOREGROUND_SERVICE permission to my manifest. It must be something else causing the problem.

Is there any way to work around this problem, so that the app still keeps fetching GPS coordinates while the device is in energy save mode?

Please help me out. We have to deploy the app in a week to the app store.

In iOS it works fine, even when the battery is in saving mode.

Thanks a lot guys!

Answers

Sign In or Register to comment.