My application worked fine with API 26 all time. However now with API 29 it stops getting GPS location while phone is locked.
B4A version is 10.0
SDK is android-29
My manifest contains:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="29"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
Also on app start I'm requesting PERMISSION_ACCESS_FINE_LOCATION via RuntimePermissions library. However it allows to get location only while application is activate. I can not use ACCESS_BACKGROUND_LOCATION via RuntimePermissions. Then I go manually to App info/Permissions/Location and set "Allow all the time". However it still does not get location while phone it locked.
For getting location I'm using Foreground service with ESLocation2 library.
I changed code to GPS libs instead of ESLocation2 as per MyLocation example also I added:
SetServiceAttribute(MY_SERVICE_NAME, android:foregroundServiceType, "location")
My application takes location every 10 seconds and uploads via HTTP POST, but afters 1-2 minutes when phone is locked GPS looses location and uploads data without valid location as there are no satellites available... As soon I unlock phone, GPS gets location again.
reference - https://www.b4x.com/android/forum/threads/background-location-tracking.99873/ i have downloaded erel's example and running it both on debug and release mode. but the problem i am facing is "GPS_LocationChanged" event is not triggering itself so i cannot able to track location of...
www.b4x.com
Many devices will turn off GPS and the CPU while they are "sleeping" even though the app acquires the partial wake lock.
This document provides guidelines and best practices for Android apps requiring background location access, focusing on critical functionality, user benefits, and compliance with Google Play policies and privacy. It includes a checklist for identifying and evaluating background location usage...