Permissions

Understand how to handle device permissions required for some ARDK features.

Feature

Required Permissions

Notes

ARSession

Camera

On Android, permission must be requested and granted before calling ARSessionFactory.Create or else the method will return null. On iOS, permission will be requested when the ARSession is first run.

Location Services

(Fine) Location

The ILocationService.StatusUpdated event will surface failures to start location services if missing permissions.

Multiplayer

Local Network

Required on iOS only. The multiplayer (MultipeerNetworking and ARNetworking) classes use peer-to-peer UDP connections in order to send low-latency messages.

Note

The VPS Wayspot Anchors feature depends on running both the ARSession and LocationService features, and thus requires all permissions required by those features.

Requesting Permissions

While iOS permissions are automatically requested by the platform the first time a feature requiring that permission is started, Android permissions must be requested somewhere in your application code. ARDK’s PermissionRequester API wraps around Unity’s Android Permissions API to provide both async/await and callback options for methods to request permissions.

To enable greater control over when/how to request permissions on both Android and iOS, a platform-agnostic permission requesting API is in development.

Using the Android Permissions Component in Unity

ARDK provides the Android Permissions helper component to make using PermissionRequester easy. Simply add the component to your AR Session Manager in Unity and configure the component to request the permissions you need.

For example, to request camera permissions from the user when your session begins, add the Android Permissions helper to your AR Session Manager. Set Size to 1, and make sure Camera is in the drop down. This ensures the app asks the user for permission to use the camera at run-time.

../../_images/placement_step4a.png