< back to main


If you are using runtime permissions for Android 6+, you should add a handler for this as early as possible in your application lifecycle. The Awake() method is typically a good place for this

void Awake ()
    AndroidBuddy.Instance.OnAndroidPermissionCallback += (requestResult) =>
        StringBuilder sb = new StringBuilder();
        sb.Append("Results for premission request:");
        bool gotoAppSettings = false;
        foreach(var p in requestResult)
            sb.Append("\nPermission: " + p.Permission);
            sb.Append(string.Format(", Result: {0} ({1})", p.Status.ToString(), p.RawStatus));
            sb.Append(", CanNotAskAgain: " + p.NeverAskAgain);

            /* p.Status will be either:
            - AndroidBuddyPermissions.NativeAndroidPermissionStatus.PERMISSION_GRANTED
            - AndroidBuddyPermissions.NativeAndroidPermissionStatus.PERMISSION_DENIED */

            // NeverAskAgain will be true if the user selected the checkbox to disable request for said permission. In this case, granting the permission can only be done from the app settings page

Checking permission status

You can retrieve the status of a permission, and this is recommended in case the user previously declined the permission - it give you the opportunity to explain why the permission us required.

AndroidBuddyPermissions.StatusResponse sr = AndroidBuddy.Instance.GetAndroidPermissionStatus(AndroidBuddyPermissions.Permissions.GET_ACCOUNTS);

Above call's result will be one of the following values:

Requesting permissions

Simply call:

AndroidBuddy.Instance.RequestAndroidPermissions(new string[] {

Or for multiple permissions at once:

AndroidBuddy.Instance.RequestAndroidPermissions(new string[] {

This will present the native permission dialogs, and result in the AndroidBuddy.Instance.OnAndroidPermissionCallback (outlined above) being fired.