Language

ILocationButtonClient.OnPermissionResult(Boolean) Method

Definition

Callback for the result of a precise location permission grant after the user interacts with the location button.

[Android.Runtime.Register("onPermissionResult", "(Z)V", "GetOnPermissionResult_ZHandler:Android.App.PermissionUI.ILocationButtonClientInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=37)]
public void OnPermissionResult(bool isGranted);
[<Android.Runtime.Register("onPermissionResult", "(Z)V", "GetOnPermissionResult_ZHandler:Android.App.PermissionUI.ILocationButtonClientInvoker, Mono.Android, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null", ApiSince=37)>]
abstract member OnPermissionResult : bool -> unit

Parameters

isGranted
Boolean

true if the permission is granted. false if the permission can't be granted.

Attributes

Remarks

Callback for the result of a precise location permission grant after the user interacts with the location button.

When a user clicks the location button for the first time, the location button consent dialog is shown and this callback is invoked when users opt to share their location. However, this callback is not invoked if the user chooses not to share their location. In subsequent sessions after the initial consent, simply clicking on the location button will invoke this callback.

The system will grant temporary precise location permission and is valid only for the current session, this is similar to an "only this time" grant in permission request dialog.

In some cases, even after a user gives consent, precise location permission may not be granted due to system-level restrictions. In this scenario, the callback will be invoked with isGranted = false. It is recommended that the app handles this case gracefully by informing the user that the app cannot obtain precise location permission (or that the app can’t access location).

Android reference for android.app.permissionui.LocationButtonClient.onPermissionResult.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to