/// <summary> /// Requests permissions to be granted to this application. /// These permissions must be requested in your manifest, they should not be granted to your app, /// and they should have protection level #PROTECTION_DANGEROUS dangerous, regardless whether they are declared by the platform or a third-party app. /// /// Requests permissions to be granted to this application. /// These permissions must be requested in your manifest, they should not be granted to your app, /// and they should have protection level #PROTECTION_DANGEROUS dangerous, /// regardless whether they are declared by the platform or a third-party app. /// /// If your app does not have the requested permissions the user will be presented with UI for accepting them. /// After the user has accepted or rejected the requested permissions you will receive a callback reporting whether the permissions were granted or not. /// /// Note that requesting a permission does not guarantee it will be granted and your app should be able to run without having this permission. /// </summary> /// <param name="permissions">The requested permissions. Must me non-null and not empty.</param> /// <param name="callback">Results of permission requests will be delivered vai this callback </param> public static void RequestPermissions(AMM_ManifestPermission[] permissions, Action <AN_PermissionsRequestResult> callback) { if (Application.isEditor) { var result = new AN_PermissionsRequestResult(); foreach (AMM_ManifestPermission perm in permissions) { var response = new AN_PermissionsRequestResponce(perm, AN_PackageManager.PermissionState.Granted); result.AddResponce(response); } callback.Invoke(result); return; } var request = new AN_PermissionsRequest(permissions); AN_Java.Bridge.CallStaticWithCallback(ANDROID_CLASS, "RequestPermissions", callback, JsonUtility.ToJson(request)); }
public void AddResponce(AN_PermissionsRequestResponce responce) { m_grantResults.Add(responce); }