Beispiel #1
0
 public AMM_PropertyTemplate AddPermission(AMM_ManifestPermission permission)
 {
     return(AddPermission(permission.GetFullName()));
 }
Beispiel #2
0
 public void RemovePermission(AMM_ManifestPermission permission)
 {
     RemovePermission(permission.GetFullName());
 }
        /// <summary>
        /// Gets whether you should show UI with rationale for requesting a permission.
        /// You should do this only if you do not have the permission and the context
        /// in which the permission is requested does not clearly communicate to the user what would be the benefit from granting this permission.
        ///
        /// For example, if you write a camera app,
        /// requesting the camera permission would be expected by the user and no rationale for why it is requested is needed.
        /// If however, the app needs location for tagging photos then a non-tech savvy user may wonder how location is related to taking photos.
        /// In this case you may choose to show UI with rationale of requesting this permission.
        /// </summary>
        /// <param name="permission">A permission your app wants to request.</param>
        public static bool ShouldShowRequestPermissionRationale(AMM_ManifestPermission permission)
        {
            if (Application.isEditor)
            {
                return(true);
            }

            if (AN_Build.VERSION.SDK_INT < AN_Build.VERSION_CODES.M)
            {
                return(false);
            }

            return(AN_Java.Bridge.CallStatic <bool>(ANDROID_CLASS, "ShouldShowRequestPermissionRationale", permission.GetFullName()));
        }
 public AN_PermissionsRequestResponce(AMM_ManifestPermission permission, AN_PackageManager.PermissionState state)
 {
     m_permission  = permission.GetFullName();
     m_grantResult = (int)state;
 }
        //--------------------------------------
        // Public Methods
        //--------------------------------------

        /// <summary>
        /// Determine whether you have been granted a particular permission.
        /// </summary>
        /// <param name="permission">The name of the permission being checked.</param>
        public static AN_PackageManager.PermissionState CheckSelfPermission(AMM_ManifestPermission permission)
        {
            if (Application.isEditor || AN_Build.VERSION.SDK_INT < AN_Build.VERSION_CODES.M)
            {
                return(AN_PackageManager.PermissionState.Granted);
            }

            var val = AN_Java.Bridge.CallStatic <int>(ANDROID_CLASS, "CheckSelfPermission", permission.GetFullName());

            return((AN_PackageManager.PermissionState)val);
        }