Android Question GPS location background

stevenindon

Active Member
Licensed User
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..
 
Top