requestLocationUpdates

@RequiresPermission(anyOf = ["android.permission.ACCESS_COARSE_LOCATION", "android.permission.ACCESS_FINE_LOCATION"])
abstract fun requestLocationUpdates(pendingIntent: PendingIntent)

Register for location updates to be delivered via the provided PendingIntent.

The delivered pending intents will contain extras with the callback information. Depending on the underlying location provider the intent will contain:

  • If the location provider is the Android system one (i.e. LocationManager), the keys used for the extras are LocationManager.KEY_LOCATION_CHANGED and LocationManager.KEY_PROVIDER_ENABLED. See the documentation for each respective extra key for information on the values.

  • If the location provider is Google Play Services Location, use com.google.android.gms.location.LocationResult.extractResult to extract the com.google.android.gms.location.LocationResult from the extras of the android.content.Intent

To unregister for location updates, use removeLocationUpdates.

Parameters

pendingIntent

intent for the location result.

Throws

if permission is not granted to access location services.