| permission | A string that describes the permission to request. For permissions which Unity has not predefined, you can provide OpenHarmony's in-built permission strings such as "ohos.permission.READ_CONTACTS". For a list of permission strings, refer to OpenHarmony's documentation on OpenHarmony Permission List. |
| onPermissionAuthorized | Callback which will be executed when application already has this permission. |
| onPermissionUnauthorized | Callback which will be executed when application do not has this permission. |
Check if the user has granted access to a device resource or information that requires authorization.
using UnityEngine; using UnityEngine.OpenHarmony;
public class CheckPermissionScript : MonoBehaviour { void Start() { Permission.CheckUserAuthorizedPermission(Permission.Camera, (string permission) => { Debug.Log(permission + ": true"); }, (string permission) => { Debug.Log(permission + ": false"); }); } }