Skip to main content
Version: 21 Aug 2024

System Notification Manager

Systems Notification Manager allows toggling the system notifications. This API is not threadsafe. More...

Functions

Name
MLResultMLSystemNotificationManagerCreate(MLHandle * out_handle)
Creates a System Notification Manager handle.
MLResultMLSystemNotificationManagerDestroy(MLHandle handle)
Destroys a System Notification Manager handle.
MLResultMLSystemNotificationManagerSetNotifications(MLHandle handle, bool suppress)
Request suppression/unsuppression of system notifications.

Detailed Description

Systems Notification Manager allows toggling the system notifications. This API is not threadsafe.

Shared Object:

  • system_notification_manager.magicleap*

Functions Documentation

MLSystemNotificationManagerCreate

MLResult MLSystemNotificationManagerCreate(
MLHandle * out_handle
)

Creates a System Notification Manager handle.

Parameters

MLHandle *out_handleThe handle to be created.

Returns

MLResultMLResult_InvalidParamFailed due to an invalid parameter.
MLResultMLResult_OkSystem Notification Manager handle was successfully created.
MLResultMLResult_PermissionDeniedNecessary permission is missing.
MLResultMLResult_UnspecifiedFailureSystem Notification Manager handle failed to be created.

Required Permissions:

  • com.magicleap.permission.SYSTEM_NOTIFICATION (protection level: normal)

Multiple calls to this API method from the same applicaiton will return the same handle. The handle is valid for the lifecycle of the application.

API Level:

  • 24

MLSystemNotificationManagerDestroy

MLResult MLSystemNotificationManagerDestroy(
MLHandle handle
)

Destroys a System Notification Manager handle.

Parameters

MLHandlehandleThe handle to be destroyed.

Returns

MLResultMLResult_InvalidParamThe handle passed in was not valid.
MLResultMLResult_OkSystem Notification Manager handle was successfully destroyed.

Required Permissions:

  • None

API Level:

  • 24

MLSystemNotificationManagerSetNotifications

MLResult MLSystemNotificationManagerSetNotifications(
MLHandle handle,
bool suppress
)

Request suppression/unsuppression of system notifications.

Parameters

MLHandlehandleHandle to System Notification Manager.
boolsuppressTrue to suppress all notifications, false to unsuppress all notifications.

Returns

MLResultMLResult_IncompatibleSKUFailed due to feature not being supported on current device version.
MLResultMLResult_InvalidParamThe handle passed in was not valid.
MLResultMLResult_OkAll system notifications were successfully suppressed/unsuppressed.
MLResultMLResult_UnspecifiedFailureSuppression/Unsuppression of system notifications failed.

Required Permissions:

  • None

Requests the system to unsuppress/suppress all notifications. This includes notifications, dialogs and alarms from being displayed. Once suppressed, notifications remain suppressed even if the application requesting suppression loses focus (ie: if the user navigates away from the application).

If the calling app is closed for any reason (ie. closed by user action, voice command, terminal command, or crashed) before notifications were unsuppressed the System Notification Manager will automatically unsuppress all notficiations (unless another application was currently suppressing notifications).

API Level:

  • 24