We have introduced a new spatial data runtime permission that allows users to control which app can access their spatial data. The permission applies to apps running on Quest 2, Quest Pro, and Quest 3. See Requesting runtime permissions for more information.
An app that wants to use Scene API needs to request spatial data permission during the app’s runtime. The request will display a one-time permission explainer dialog, followed by a permission consent confirmation dialog. Only when the permission is granted by the users can the apps query all spatial data on the user’s device.
Devices
Accessing spatial data through the new permission flow is effective on Quest 2, Quest Pro, and Quest 3.
Link
There is no need to request scene runtime permission when developing apps via Link. Apps running from Link will continue accessing spatial data when querying for anchors on the device.
Declare the permission
In your app’s AndroidManifest.xml, declare the following permission:
As per the Android permission guidelines, it is recommended to request the permission only when using the functionality, and to provide a fallback if the user decides not to grant the permission.
If the app is compiled with the current versions of the SDK, there is no requirement to request the permission in the app. The system will automatically show a permission dialog when the app is launched.
How to request permission
Request the permission in Java in a NativeActivity:
package com.oculus.test.permissionTestApp;
import android.content.pm.PackageManager;
import android.os.Bundle;
import android.util.Log;
public class MainActivity extends android.app.NativeActivity {
private static final String PERMISSION_USE_SCENE = "com.oculus.permission.USE_SCENE";
private static final int REQUEST_CODE_PERMISSION_USE_SCENE = 1;
static {
System.loadLibrary("openxr_loader");
System.loadLibrary("permissionTestApp");
}
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
requestScenePermissionIfNeeded();
}
private void requestScenePermissionIfNeeded() {
if (checkSelfPermission(PERMISSION_USE_SCENE) != PackageManager.PERMISSION_GRANTED) {
requestPermissions(new String[] {PERMISSION_USE_SCENE}, REQUEST_CODE_PERMISSION_USE_SCENE);
}
}
}
If users do not grant spatial data permission, the function XrQuerySpacesFB will not return XrSpace. This behavior will occur regardless of what filter is applied. Specifically, XrQuerySpacesFB will not return a XrSpace that contains the following XrSpaceComponentTypeFB. This will be true even if a scene has been captured on the user’s device: