ARCore (Unity) Camera Permissions Dialog Never Shown

When using ARCore in Unity, any apk that I publish doesn't ask for Camera Permissions.

I've noticed that in the Android Studio AR Demo code that they were using a CameraPermissionsHelper class, and are calling the requestCameraPermissions() in the onResume(). This is easy for a project created in Android Studio, but doesn't help in Unity.

The Unity ARCore SDK does contain a AndroidPermissionsManager, but, I'm not quite sure how to implement in Unity correctly.

Has anyone solved or come across this issue at all?

Are you using the SessionComponent in ARCore? It manages the connection lifecycle, as well as requesting camera permission. You can see an example of its use in the HelloAR sample scene. See also SessionComponent.Connect in GoogleARCore/SDK/Scripts/SessionComponent.cs

Yes, I attached a screenshot showing the SessionComponent setup.

I see where the Connect method is calling the AndroidPermissionsManager.RequestPermission, not sure why the permissions dialog is never shown.

Testing on a Pixel XL.

I have to install and launch the apk, and manually toggle the camera permissions in order for the passthrough to show correctly.

3237649--248755--Screen Shot 2017-09-28 at 8.26.22 PM.png

Looking thru logcat when running a fresh install, I was able to find this AndroidJavaException:

09-28 21:02:43.753 6427 6443 E Unity : AndroidJavaException: java.lang.IllegalStateException: Fragment null must be a public static class to be properly recreated from instance state.
09-28 21:02:43.753 6427 6443 E Unity : java.lang.IllegalStateException: Fragment null must be a public static class to be properly recreated from instance state.
09-28 21:02:43.753 6427 6443 E Unity : at android.app.BackStackRecord.doAddOp(BackStackRecord.java:429)
09-28 21:02:43.753 6427 6443 E Unity : at android.app.BackStackRecord.add(BackStackRecord.java:414)
09-28 21:02:43.753 6427 6443 E Unity : at com.unity3d.player.UnityAndroidPermissions.RequestPermissionAsync(UnityAndroidPermissions.java:66)
09-28 21:02:43.753 6427 6443 E Unity : at com.unity3d.player.UnityPlayer.nativeRender(Native Method)
09-28 21:02:43.753 6427 6443 E Unity : at com.unity3d.player.UnityPlayer.c(Unknown Source:0)
09-28 21:02:43.753 6427 6443 E Unity : at com.unity3d.player.UnityPlayer$c$1.handleMessage(Unknown Source:151)
09-28 21:02:43.753 6427 6443 E Unity : at android.os.Handler.dispatchMessage(Handler.java:101)
09-28 21:02:43.753 6427 6443 E Unity : at android.os.Looper.loop(Looper.java:164)
09-28 21:02:43.753 6427 6443 E Unity : at com.unity3d.player.UnityPlayer$c.run(Unknown Source:20)
09-28 21:02:43.753 6427 6443 E Unity : at UnityEngine.AndroidJNISafe.CheckException () [0x0008c] in /Users/builduser/buildslave/unity/build/Runtime/Export/AndroidJNISafe.cs:24
09-28 21:02:43.753 6427 6443 E Unity : at UnityEngine.AndroidJNISaf

After granting camera permissions manually, this error does not appear.

1 Like

I’m having the exact same issue. I am using the pixel XL as well

1 Like

Having the same issue for the Pixel XL, haven't found a solution as far as release goes but have for testing's sake.

You can open the system settings of the device and search for "Permissions" and manually allow Camera Access for both Tango and your app; this should allow you to work.

Same issue too with a Pixel XL

[Edit]Seems to be dependent of the Android SDK version, if you use the API26 there is the issue, but not with the API24

1 Like

Ditto here. No permissions popup on my Pixel XL. Took me a while to figure that out, and it was only after reading these forums that I realized I had to manually grant camera permissions after reading these forums. I thought it was broken at first.

Same issue here, on a Pixel.

I disagree*, I have Minimum API Level set to API24 and I have this issue.

*Note: I am, however, targeting “Automatic (highest installed)”, though he list only goes up to 25.

Same here on Pixel 2 XL. When I check 'ARCore Supported' under XR Settings, no permissions are requested on launch of the app and inspection of temp/staging/androidmanifest.xml shows this is probably the cause:

When 'ARCore Supported' is not checked, permissions prompt is shown correctly.

I put a copy of this AndroidManifest.xml file in Assets/Plugins/Android/ folder with the value changed to false, but unfortunately the app just crashes on launch failing to find the launcher activity class. Any tips on how to override this value?

Same, on a pixel, is there any fix for this?

Might try to check the mark under File → Build settings → Player Settings → XR settings → AR core supported