Handling App Permissions
Applications built using Snapdragon Spaces can be deployed onto a mobile device connected to AR glasses or onto All-In-One (AIO) headsets. For mobile device deployment, there is currently support for Android-based mobile phones and this may extend to other Android-based touch platforms in the future. Android-based applications require permissions to be authorized in order to access data, or perform some actions. These permissions are granted per-application by the end-user. For more information on this, see the Permissions on Android page on Android’s developer website. Note also the Unity-specific changes needed to set up Android permissions in a Unity project.
Launch Models
When running Snapdragon Spaces apps on a mobile phone with connected AR glasses, there are two launch models to choose from: Headworn and Dual Render Fusion. This is described in more detail on the Architecture page for Dual Render Fusion.
Snapdragon Spaces apps require certain permissions to be authorized to fully use some features.
Feature | OpenXR Runtime permission required | Application permission required |
---|---|---|
Camera Access | No | Yes |
Hand Tracking | Yes, prior to starting OpenXR services | No |
Hit Testing | Yes | No |
Image Tracking | Yes | No |
Plane Detection | Yes | No |
QR Code Tracking | Yes | No |
Spatial Anchors | Yes | No |
Spatial Meshing | Yes | No |
See Handling App Permissions with Dual Render Fusion for specific recommendations about working with permissions using the Dual Render Fusion launch model.
See Handling App Permissions with Headworn Launch Model for specific recommendations about working with permissions using the Headworn launch model.
Checking Permissions While the App is Running
Permissions can be checked at any time while the application is running when using either of the two launch models by writing checks in Unity like this:
// request android.permission.RECORD_AUDIO
string permissionToRequest = Permission.Microphone;
if (!Permission.HasUserAuthorizedPermissions(permissionToRequest))
{
...
// Prevent access to application systems which require android.permission.RECORD_AUDIO
...
}
Requesting Permissions While The App Is Running
When using Dual Render Fusion, permissions may be requested at any time while the application is running. When using the Headworn launch model these requests are not permitted. Verify if it is safe to make the request before making it:
var nativeXRSupportChecker = new AndroidJavaClass("com.qualcomm.snapdragon.spaces.serviceshelper.NativeXRSupportChecker");
if (nativeXRSupportChecker.CallStatic<bool>("CanShowPermissions") || OpenXRSettings.Instance.GetFeature<FusionFeature>().enabled)
{
Permission.RequestUserPermission(permissionToRequest);
}