Skip to content Skip to sidebar Skip to footer

Should I Need To Unregister Locationcallback For Fusedlocationproviderclient?

i am trying to get user's location in background using service. I am using FusedLocationProviderClient for complete this task and i am doin all this thing in my service class. I a

Solution 1:

You need to unregister the callback so you don't get the result every time. You can use:

fusedLocationProviderClient.removeLocationUpdates(locationCallback);

You need to make locationCallback class scope so you can call it outside the onStartCommand()

Post a Comment for "Should I Need To Unregister Locationcallback For Fusedlocationproviderclient?"