Camera Permissions issue in Android

0 votes
asked Jul 15, 2021 by thedapperlab (260 points)

Hoping you can help - have a very urgent issue with not being able to grant camera permissions on Android.  No dialogue shows, and we can't ask permissions via the standard Unity tools - it seems as if the EasyAR system failing is causing the app to think permission has been denied?

Debug from logcat looks like this:

2021/07/15 15:06:07.445 25518 25586 Error EasyAR CameraDevice.requestPermissions callback: St13runtime_error

2021/07/15 15:06:07.445 25518 25586 Error EasyAR easyar.UIPopupException: Camera permission not granted

2021/07/15 15:06:07.445 25518 25586 Error EasyAR easyar.UIPopupException: Camera permission not granted

2021/07/15 15:06:07.445 25518 25586 Error EasyAR at easyar.Detail.FunctorOfVoidFromPermissionStatusAndString_func (System.IntPtr state, easyar.PermissionStatus arg0, System.IntPtr arg1, System.IntPtr& exception) [0x0003b] in C:\Users\Dom Jones\Documents\Unity Github Projects\ShapMVP\Assets\ThirdPartyLibs\EasyAR\Scripts\Binding\csapi.cs:2375

Running EasyAR Unity Plugin v 4.2.0.1102 In Unity v 2019.2.21f1

Any and all help greatly appreciated!!

2 Answers

0 votes
answered Jul 15, 2021 by kenn (18,750 points)
The error log says permission not grant and nothing more.

What is the status of camera permission of the application? You can check it in the Android system. If there is no camera permission to set, check the AndroidManifest in the project.

And... have you tried the samples in an empty Unity project?
0 votes
answered Jul 31, 2021 by wjrivera (800 points)
Hello, I use this to request the camera's permissions, you can try:

        public void requestCameraPermission()
        {
            if (Application.platform == RuntimePlatform.Android && !UnityEngine.Android.Permission.HasUserAuthorizedPermission(UnityEngine.Android.Permission.Camera)) { UnityEngine.Android.Permission.RequestUserPermission(UnityEngine.Android.Permission.Camera); }
            else if (Application.platform == RuntimePlatform.IPhonePlayer && !Application.HasUserAuthorization(UserAuthorization.WebCam)) { Application.RequestUserAuthorization(UserAuthorization.WebCam); }
        }
commented Aug 6, 2021 by thedapperlab (260 points)
Thanks for the input all - the issue was that we had moved the package into a sub-folder (where all our third-party libs/plugins were living).

Moving it back to the root of the project structure solved the issue - no idea why, though?  Would be interesting to understand...
Welcome to EasyAR SDK Q&A, where you can ask questions and receive answers from other members of the community.
...