Search Unity

Camera permissions in UCB Android build

Discussion in 'Unity Cloud Build' started by 4fthawaiian, Nov 10, 2015.

  1. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    Hello,

    Just wondering what is missing from our UCB generated APK's. When I generate a APK file locally and share it via dropbox or similar, the install prompts to grant camera access. APK files generated by UCB don't do this, and thus the app has no camera access. I've seen some references to adding a manifest XML to the plugins directory in our repo, but I'm not sure how that would work. Can anyone point me in the right direction? TIA
     
  2. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    757
    How are you getting this permission into your builds locally? If you add a manifest at Assets/Plugins/AndroidManifest.xml it should get used when compiling for android (locally and when building with UCB).
     
  3. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    That's the funny thing. I'm not doing anything explicit in my local builds. I have checked the AndroidManifest.xml that is created in the APK, though, and the permission is there.
     
  4. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    and, interestingly enough, I've just examined the APK from UCB and it also has the camera permission in the AndroidManifest.xml file. However, when I'm installing it says it requires no permissions. smh.
     
  5. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    Also, what should the format of the xml file that I add be like? Should it be the full AndroidManifest.xml file, or just the portions I need. Does UCB/Unity merge my stuff into the standard AndroidManifest.xml file that gets built?
     
  6. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    757
    I forgot that unity modifies the set of permissions based on the code you are using (this behavior should be the same in UCB as well). If you want to try using your own android manifest, yes it would be the entire AndroidManifest.xml.

    As for why it's not asking for the permission when installing from UCB - are you installing a brand new version of the app, or an update? Updates won't ask for that permission if it hasn't changed from the previous version.
     
  7. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    I've tried both - fresh install, and removing the app entirely and installing from scratch. As I've said, the permission is definitely there in the AndroidManifest.xml, it's just not prompting me when I install from UCB. Thanks for the attention. I hope I can get this resolved. UCB is a very handy way of distributing to a few of our offsite people.
     
  8. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    757
    I can't think of why that might be the case. If the permission shows up in the apk built from UCB it should be prompting on install. Are you not getting prompted for any permissions, or just not for camera permission?

    Double checked with one of my test apps and during install it has a screen with "Install this application? It will have access to: ..." and a list of a few permissions required for that app with Cancel/Install buttons. Are you seeing different behavior?
     
  9. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    Interestingly enough, I just tried it on a different device, and yes, I am being prompted to grant permissions. However, on the original device I was testing on (a nexus 9) it explicitly said it required no special permissions. That's very odd.
     
  10. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
  11. dannyd

    dannyd

    Unity Technologies

    Joined:
    Jun 3, 2014
    Posts:
    757
    Very strange. The only time I've seen that happen before was when providing a custom AndroidManifest.xml with some missing closing tags. Since this is using the generated one I wouldn't expect it to be generating an invalid manifest. Might be worth actually diffing the manifest from your local apk and the one built from UCB and see if there are any discrepancies. Other than that, my only suggestion would be to change the bundle id that UCB is using to build with to something you know for sure you have never used on that device and test again. It's possible there is some conflict there with previously installed versions with that same bundleid (just a guess).
     
  12. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    Thanks, Danny. I'll try it out, but given the root problem (camera access in the app is failing) I don't think it's the bundle ID or anything like that. For now, I'll have to use dropbox or google drive to share builds instead of UCB builds.
     
  13. pandigital

    pandigital

    Joined:
    Mar 20, 2009
    Posts:
    15
    I think this is related to the latest version of Android (marshmallow) which your Nexus may have updated to.
    You have to manually allow camera permissions in settings - this is not ideal and hopefully Unity devs can fix this asap.
    Over to dannyd...
     
  14. 4fthawaiian

    4fthawaiian

    Joined:
    Dec 18, 2013
    Posts:
    33
    Interesting. I'll try this out on another device without marshmallow and respond here.