Exemple #1
0
    private string GetAuthorClicked(String strpermission)
    {
        string strResult = "";

        try
        {
            AndroidRuntimePermissions.Permission result = AndroidRuntimePermissions.RequestPermission(strpermission);
            switch (result)
            {
            case AndroidRuntimePermissions.Permission.Denied: //永久拒绝询问
                strResult = ("权限被拒绝且不再询问");
                AndroidRuntimePermissions.OpenSettings();     // 打开本程序的设置界面
                break;

            case AndroidRuntimePermissions.Permission.Granted:    //允许
                strResult = ("权限已开启");
                break;

            case AndroidRuntimePermissions.Permission.ShouldAsk:    //拒绝权限但不拒绝询问
                strResult = ("权限被拒绝");
                break;
            }
        }
        catch (Exception eee)
        {
            strResult = eee.Message;
        }
        return(strResult);
    }
    public void OpenSettings()
    {
        #if UNITY_IOS && !UNITY_EDITOR
        NativeSettings.GetSettingsURL_Native();
        #endif

        #if UNITY_ANDROID && !UNITY_EDITOR
        AndroidRuntimePermissions.OpenSettings();
        #endif

        HideWarningPanel();
    }
 public void OpenSettings()
 {
     AndroidRuntimePermissions.OpenSettings();
     settingsPanel.SetActive(false);
 }