Permissions for Headworn Launch Model
The headworn launch model lacks a mechanism to handle native Android pop-ups at runtime. Instead, permissions must be requested and authorized from the mobile phone prior to any content displaying on the glasses.
In this model the Unity activity is running on the glasses, and so any permissions requested from Unity will not be displayed on the phone. Instead, they would be presented on the glasses where they cannot be interacted with. Permissions must be requested from an activity running on the mobile phone and so cannot be requested after launch. The Snapdragon Spaces SDK automatically initiates a permission check upon application launch.
Setting Up Manifest Permissions
Developers should follow Unity guidelines to add permissions into the Android manifest.
The simplest way to achieve this is to use a custom main manifest and add any required permissions to it.
E.g. to request the background location permission, add the following to the custom manifest.
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION"/>
When the application starts, the permission will be requested.
Customizing Permission Behaviour
The Snapdragon Spaces SDK includes an archive Activities_Android_Project_X_XX_X.zip. This archive contains source code for the Snapdragon Spaces SDK Activities project.
This project is normally pre-compiled and included automatically in a Snapdragon Spaces project.
The following information is only relevant to developers seeking more control over the behavior of the permission checks. Familiarity with Android native API's and java code is essential.
The SplashScreenActivity
handles permission checks through a PermissionHelper
class which checks the permissions for both the OpenXR Runtime application (see the section below), and the Headworn application.
See:
project\src\main\java\com\qualcomm\snapdragon\spaces\splashscreen\SplashScreenActivity.java
project\src\main\java\com\qualcomm\snapdragon\spaces\helpers\PermissionHelper.java
For simplicity, the SplashScreenActivity is configured to automatically initiate a security permission check upon application launch. It is possible to modify the project to modify this behaviour.
Make a backup of the original file before proceeding.
Run the
assemble
task to build the modified project by invoking thegradle assemble
or./gradle assemble
command.Replace the following file from the Snapdragon Spaces SDK package with the result of the build:
SnapdragonSpacesPlugin\Packages\com.qualcomm.snapdragon.spaces\Runtime\Core\Android\SpacesActivities.aar
This approach is not recommended. It is much simpler to use the Dual Render Fusion launch model to handle permissions!
Permissions for the OpenXR Runtime with the Headworn Launch Model
When an application is built with the Snapdragon Spaces SDK, the OpenXR Runtime application must have certain permissions granted to it for the Unity application to function correctly:
- Camera permissions must be granted to the OpenXR Runtime to use most Snapdragon Spaces perception features.
- The advanced setting Display over other apps must be allowed on the OpenXR Runtime.
For the headworn launch model, the SplashScreenActivity
in the Snapdragon Spaces Activities project verifies that the OpenXR Runtime application is installed, and that these permission checks have been granted.
All of these checks are made at application launch time.