Permission
- Last UpdatedJan 13, 2025
- 3 minute read
The Permission node requests permission at run-time and checks throughout the session whether the user has granted permission that is required by some mobile app features. Mobile apps are executed inside a sandbox and they ask user to actively grant permissions to access sensible resources, such as Camera and Contacts features on the phone. This node keeps permissions state updated throughout the app session automatically.
Note: Permission fields are internally calculated. If a user overrides the value of these fields through the scripting, it could lead to incorrect app behaviors.
Platform support
This node is fully supported on XR-Portable IOS and XR-Portable Android only.
|
XR-WIN |
XR-P-WIN |
XR-P-IOS |
XR-P-AND |
XR-P-WASM |
|---|---|---|---|---|
|
No support |
No support |
Full support |
Full support |
Full support |
|
|
|
|
|
|
Different devices and different permissions
Not all devices support the same set of permissions. Those permissions not supported by a device will remain in an unknown state forever and cannot be requested.
Notes about permissions update on different platforms:
-
Android and iOS app update and sync all require the permissions state with system at every application start.
-
Hololens 2 updates the permissions state only after it has been requested from script or from a consumer feature.
Code example
This is a code example for the Permission node.
<setfield name="arManager.active" value="true" condition="@permission.camera@==granted"/>
Fields
These are the fields for the Permission node. Only the node-specific fields are indicated, not fields obtained by inheritance.
Field inheritance: NodeBase > Permission
|
Fields |
Type |
Use |
Default |
Description |
|---|---|---|---|---|
|
camera |
senum |
Read-only |
unknown |
Returns the current state of camera permission in a session. It is continually updated for the user’s response regarding this permission throughout the session. When app is started, the value of this field could change at any time to be either granted or denied. |
|
microphone |
senum |
Read-only |
unknown |
Returns current state of microphone permissions in an app session. It is continuously updated in response to user input regarding this permission throughout the app session. When app is started, the value could be either granted or denied at anytime. |
|
request |
sfunction |
Optional |
This field asks for required permission at run-time. It requires permission name as its argument. |