Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unity3d check if user has authorized device camera

I have developed an app with Vuforia for iOS and Android, when the app is run for the first time, the user is prompted to authorize the use of the device's camera.

If the user does not authorize the camera, when the user navigates to the "capture" scene, the camera view is black.

I have looked at the Untiy3D Documentation and found the Application.HasUserAuthorization class, but if I understand correctly, this only works on the Unity web player?

How can I check if the user has allowed the use of the camera in Unity3D (c#).

Any suggestions would be greatly appreciated! TIA!

like image 928
Ronny vdb Avatar asked Sep 30 '14 22:09

Ronny vdb


1 Answers

As a user on Android I get prompted when installing the apk that it will use the Camera, once I accept that is it. As a developer I don't need to check.

This is how I start the camera using Vuforia API.

 CameraDevice.Instance.Stop();
 CameraDevice.Instance.Init(CameraDevice.CameraDirection.CAMERA_FRONT);
 CameraDevice.Instance.Start();

CameraDevice is a Singleton that you can call.

like image 178
apxcode Avatar answered Oct 31 '22 22:10

apxcode