Search Unity

Unity android app not asking for permission.

Discussion in 'Editor & General Support' started by MythzFreeze, Mar 15, 2017.

  1. MythzFreeze

    MythzFreeze

    Joined:
    Feb 9, 2017
    Posts:
    2
    Hey,

    I have this
    <uses-feature android:name="android.hardware.camera" android:required="true" />
    <uses-feature android:name="android.hardware.camera.autofocus" />

    and
    <uses-permission android:name="android.permission.CAMERA" />

    In my android manifest but i still need to manually go to settings->apps>app>permissions and enable it there. This is ofcourse no good if i want to get people to use it.
    (the camera gets used by a plugin called vuforia)

    Thanks.
     
  2. peteradvr

    peteradvr

    Joined:
    Dec 22, 2016
    Posts:
    11
    I'm in the same situation. I'm writing a cardboard app that is Unity the NatCam plugin from the asset store to try to read a QR code. Its not requesting the camera permission when the app launches. If I add permissions following your steps then it works. If you figure this out I'd be interested in what your solution was.

    I'm on Unity 5.6 and was testing on a Samsung Galaxy S7.
     
    sprengerst and Fabien-LG like this.
  3. tabworldmedia

    tabworldmedia

    Joined:
    Nov 18, 2014
    Posts:
    2
    Same situation here for
    • Unity 2017.1f3 (OS X)
    • Minimum API level 21 (Lollipop)
    • Target API level 26 (auto, selected Oreo)

    Any update on this?

    NOTE: the permissions are automatically generated by Unity from using a WebcamTexture.

    Manifest looks like this:

    <uses-permission
    android:name="android.permission.CAMERA" />

    <uses-feature
    android:name="android.hardware.camera"
    android:required="false" />

    <uses-feature
    android:name="android.hardware.camera.autofocus"
    android:required="false" />

    <uses-feature
    android:name="android.hardware.camera.front"
    android:required="false" />​
     
    RenanRL likes this.
  4. GrenadeJane

    GrenadeJane

    Joined:
    Feb 20, 2014
    Posts:
    2
    Hi,
    I just had the same issue here, when I upgrade my version of Unity from 5.5.3 to 5.6.0.
    I used Vuforia and the gvr plugin from Google, my solution was to carefully remove all the residues of the old Google plugin ( gvr library permission ).
    Hope it will help some of you,
    Cheers.
     
  5. rinkusaru

    rinkusaru

    Joined:
    Sep 7, 2017
    Posts:
    14
    Is there any solution to it I'm facing the same issue.
     
  6. TotalReality

    TotalReality

    Joined:
    Oct 13, 2016
    Posts:
    11
    same here since last week :/

    Solved it by changing the targetSDK to 25. Instead of highest possible sdk. So it seems the problems occurs only with targetSDK 26/android 8.0
     
    Last edited: Mar 20, 2018
    rinkusaru likes this.
  7. rinkusaru

    rinkusaru

    Joined:
    Sep 7, 2017
    Posts:
    14
    I'm still getting this issue and changing the target version to 25 doesn't work for me as I've already selected that.
    Is there any other fixes for this issue.
     
  8. Saicopate

    Saicopate

    Joined:
    Sep 25, 2017
    Posts:
    76
    Same problem here. I guess I will have to implement an independent permission request subsystem like UniAndroidPermission.
     
  9. mhogle

    mhogle

    Joined:
    Jan 3, 2016
    Posts:
    20
    Saicopate likes this.
  10. adgluzdoff

    adgluzdoff

    Joined:
    Jul 11, 2018
    Posts:
    1
    try delete NatCam
     
  11. samra2494

    samra2494

    Joined:
    Nov 23, 2015
    Posts:
    21
    The issue is resolved. :) The following solution works for me.. i think it helps you too. just put this script on camera
    using UnityEngine;
    using UnityEngine.Android;


    public class permissionscript : MonoBehaviour
    {
    GameObject dialog = null;
    void Start()
    {
    #if PLATFORM_ANDROID
    if (!Permission.HasUserAuthorizedPermission(Permission.Camera))
    {
    Permission.RequestUserPermission(Permission.Camera);
    }
    #endif
    }
    }


    // here is my device camera script

    using UnityEngine;
    using UnityEngine.UI;

    public class simplecamera : MonoBehaviour
    {
    static WebCamTexture backCam;

    void Start()
    {
    WebCamDevice[] devices = WebCamTexture.devices;
    if(backCam == null)
    {
    backCam = new WebCamTexture();
    }
    GetComponent<RawImage>().texture = backCam;
    backCam.Play();
    }
    }
     
    blindsp0t and khanhabib like this.
  12. khanhabib

    khanhabib

    Joined:
    Oct 11, 2018
    Posts:
    29
    this method works but you have to close and open again the app so camera will work