Skip to main content
Version: 12 Dec 2024

ml_zi_permissions.h

Functions

Name
MLResultMLZIPermissionsStart()
Start the ZI permissions system. This must be called before other permissions calls.
MLResultMLZIPermissionsStop()
Stop the ZI permission system. Call to clean up the ZI permission system at application termination.
MLResultMLZIPermissionsIsGranted(const char * permission_name)
Asks if the application has the given permission granted.
MLResultMLZIPermissionsRequest(const char * permission_name)
Request the given permission (blocking if pending until user either allows or denies permission). Client code can poll the permission state to see if the permission was granted, denied or still pending.

Functions Documentation

MLZIPermissionsStart

MLResult MLZIPermissionsStart()

Start the ZI permissions system. This must be called before other permissions calls.

Returns

MLResultMLResult_OkIf query was successful.
MLResultMLResult_UnspecifiedFailureThere was an unknown error.

Required Permissions:

  • None

API Level:

  • 20

MLZIPermissionsStop

MLResult MLZIPermissionsStop()

Stop the ZI permission system. Call to clean up the ZI permission system at application termination.

Returns

MLResultMLResult_OkIf query was successful.
MLResultMLResult_UnspecifiedFailureThere was an unknown error.

Required Permissions:

  • None

API Level:

  • 20

MLZIPermissionsIsGranted

MLResult MLZIPermissionsIsGranted(
const char * permission_name
)

Asks if the application has the given permission granted.

Parameters

const char *permission_nameThe permission name.

Returns

MLResultMLResult_InvalidParamThe permission_name parameter is not valid (or null).
MLResultMLResult_OkThe permission is granted.
MLResultMLResult_PermissionDeniedIf permission denied.
MLResultMLResult_PendingIf permission request has not been resolved.
MLResultMLResult_UnspecifiedFailureThere was an unknown error.

Required Permissions:

  • Any

See: https://developer.android.com/training/permissions/requesting

API Level:

  • 20

MLZIPermissionsRequest

MLResult MLZIPermissionsRequest(
const char * permission_name
)

Request the given permission (blocking if pending until user either allows or denies permission). Client code can poll the permission state to see if the permission was granted, denied or still pending.

Parameters

const char *permission_nameThe permission name.

Returns

MLResultMLResult_InvalidParamThe permission_name parameter is not valid (or null).
MLResultMLResult_OkThe query was successful.
MLResultMLResult_UnspecifiedFailureThere was an unknown error.

Required Permissions:

  • None

See: https://developer.android.com/training/permissions/requesting

API Level:

  • 20

Source code

// %BANNER_BEGIN%
// ---------------------------------------------------------------------
// %COPYRIGHT_BEGIN%
// Copyright (c) 2021 Magic Leap, Inc. All Rights Reserved.
// Use of this file is governed by the Software License Agreement,
// located here: https://www.magicleap.com/software-license-agreement-ml2
// Terms and conditions applicable to third-party materials accompanying
// this distribution may also be found in the top-level NOTICE file
// appearing herein.
// %COPYRIGHT_END%
// ---------------------------------------------------------------------
// %BANNER_END%

#pragma once

#include "ml_api.h"

ML_EXTERN_C_BEGIN

ML_API MLResult ML_CALL MLZIPermissionsStart();

ML_API MLResult ML_CALL MLZIPermissionsStop();

ML_API MLResult ML_CALL MLZIPermissionsIsGranted(const char *permission_name);

ML_API MLResult ML_CALL MLZIPermissionsRequest(const char *permission_name);

ML_EXTERN_C_END