Hello all,
I have been building an app for my customer - tracking user location in the background. Followed example app by erel :
The application runs non stop on android 9 (Samsung) sending user location to server....but rapidly stopped on android 12 after phone idle for 20 minutes (Oppo). Will continue for a short while again only when i wakes up phone. (* I puts beeping sound when upload location to server)
Below are GPS request permissions :
1) rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
2) rp.CheckAndRequest("android.permission.ACCESS_BACKGROUND_LOCATION") - *Phone1.SdkVersion >= 29
3) JavaObject1.RunMethod("isIgnoringBatteryOptimizations", Null) * Ignore battery optimization
Menifest :
AddPermission(android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
SetServiceAttribute(TWP_GPSService, android:foregroundServiceType, "location")
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
Did i miss something? Please help..
I have been building an app for my customer - tracking user location in the background. Followed example app by erel :
Background location tracking
Simple example of a foreground service that keeps the process running in the background. The current location is shown in the persistent notification. The app starts at boot and theoretically should run all the time. It also schedules itself to run with StartServiceAt. This can help in cases...
www.b4x.com
The application runs non stop on android 9 (Samsung) sending user location to server....but rapidly stopped on android 12 after phone idle for 20 minutes (Oppo). Will continue for a short while again only when i wakes up phone. (* I puts beeping sound when upload location to server)
Below are GPS request permissions :
1) rp.CheckAndRequest(rp.PERMISSION_ACCESS_FINE_LOCATION)
2) rp.CheckAndRequest("android.permission.ACCESS_BACKGROUND_LOCATION") - *Phone1.SdkVersion >= 29
3) JavaObject1.RunMethod("isIgnoringBatteryOptimizations", Null) * Ignore battery optimization
Menifest :
AddPermission(android.permission.REQUEST_IGNORE_BATTERY_OPTIMIZATIONS)
AddManifestText(<uses-feature android:name="android.hardware.location.gps"/>)
SetServiceAttribute(TWP_GPSService, android:foregroundServiceType, "location")
AddPermission(android.permission.ACCESS_FINE_LOCATION)
AddPermission(android.permission.ACCESS_BACKGROUND_LOCATION)
Did i miss something? Please help..