1. Help us improve the editor usability and artist workflows. Join our discussion to provide your feedback.
    Dismiss Notice
  2. We're looking for feedback on Unity Starter Kits! Let us know what you’d like.
    Dismiss Notice
  3. We’re giving 2017.1 beta testers a chance to win t-shirts and a Nintendo Switch. Read more on the blog.
    Dismiss Notice
  4. We want to know how you learned Unity! Help us by taking this quick survey and have a chance at a $25 gift card
    Dismiss Notice
  5. Unity 5.6 is now released.
    Dismiss Notice
  6. Check out all the fixes for 5.6 on the patch releases page.
    Dismiss Notice

Native VR integration (Daydream & Cardboard) blocks Android camera permission

Discussion in 'Virtual Reality' started by Acctubi, Jun 19, 2017.

  1. Acctubi

    Acctubi

    Joined:
    Jan 26, 2016
    Posts:
    10
    Hello,

    It seems like I found a bug where the usage of either cardboard or daydream for Android blocks the camera permission. Whenever I add cardboard or daydream to the player settings (VR SDK's) the app does not ask for the permission of using the camera. This results in a black camera feed without errors.
    Building the apk without both SDK's on the other hand results in the usual permission request at the start of the app. Additionally, the permission is still kept even if a new apk with Daydream and Cardboard SDK's is built.

    My assumption is that it might be caused by higher Target SDK versions for Android when using VR.
    Has anyone experienced the same issue? I couldnt find any workaround so far.

    Thanks in advance!
     
  2. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,032
    While I haven't encountered this, I would assume it's caused by the android manifest that is included in the newer versions of the sdk. Have you tried editing them to ask for the permission?
     
  3. Acctubi

    Acctubi

    Joined:
    Jan 26, 2016
    Posts:
    10
    Thanks for the hint!
    Yes I have tried adding the following lines to the cardboard manifest and it did not help:

    Code (CSharp):
    1. <!-- camera permission -->
    2.   <uses-permission android:name="android.permission.CAMERA"/>
    3.   <uses-permission android:name="android.hardware.camera"/>
    4.   <uses-feature android:name="android.hardware.camera"/>
    Would I need to change the manfiest in the Unity Project or in the SDK itself?
     
  4. greggtwep16

    greggtwep16

    Joined:
    Aug 17, 2012
    Posts:
    1,032
    Either is fine, I know that the sdk has multiple manifests that get merged. You can verify that it's still present in the final manifest by building to a project and opening it up in eclipse or android studio and verifying the manifest still has the values you expect there.
     
    Acctubi likes this.
  5. Acctubi

    Acctubi

    Joined:
    Jan 26, 2016
    Posts:
    10
    Adding the above mentioned camera permissions to all unity project manifest files fixed the issue. Thanks!
     
    greggtwep16 likes this.