Permissions not correctly triggered in iOS


#1

Hi,

We’re using Universal AR SDK for Unity to develop a gyro-oriented experience.
The experience will be deployed for web browser (Unity WebGL).
We’re using Unity 2020.2.2f1

We’re trying to avoid the permissions UI provided with the SDK.

So, we tried replacing the
Z.PermissionRequestUI()
line in the ZapparCamera script with
Z.PermissionRequestAll() and also with a combination of
Z.PermissionRequestCamera() directly followed with Z.PermissionRequestMotion().

This seems to work in Android but not in iOS.
In particular, it seems that the camera permission is correctly triggered, and the accelerometer one is never triggered.

Are we doing something wrong?

Thanks,
Alessio


#2

Hi @a.bottosso

Due to browser restrictions, the permission request must come from a user’s action, such as a button click. ( This is why simply calling Z.PermissionRequestAll() does not work in all browsers )

What our provided PermissionRequestUI function does is:
Query the permissions:​
navigator.permissions.query({ name: "camera" });
Then we create a button, which when clicked, requests the relevant permissions:

navigator.mediaDevices.getUserMedia({
   video: true
});

You will need to alter the html template to request the permissions from a user’s interaction :slight_smile: