Fused-Location-API-Example
Fused-Location-API-Example copied to clipboard
Background Location Update
In the foreground, the app works beautifully, but as soon as I make the app go to the background, the location updates don't get triggered at all. Have added ACCESS_BACKGROUND_LOCATION permission in Manifest and I'm requesting ACCESS_BACKGROUND_LOCATION permission on App Launch.
Android Manifest
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
PermissionUtils
fun requestAccessFineLocationPermission(activity: AppCompatActivity, requestId: Int) { ActivityCompat.requestPermissions( activity, arrayOf( Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_BACKGROUND_LOCATION ), requestId ) }
Am i missing anything here ?
@nidhinprathap Have you found a solution to make it work in the background?
Manully giving the APP permission to use GPS always doesnt help either, so it must be something with the code not including background updates
@mishra3452, you think it's possible to add so that background updates work too?