{"action":"created","issue":{"url":"https://api.github.com/repos/facebook/react-native/issues/13097","repository_url":"https://api.github.com/repos/facebook/react-native","labels_url":"https://api.github.com/repos/facebook/react-native/issues/13097/labels{/name}","comments_url":"https://api.github.com/repos/facebook/react-native/issues/13097/comments","events_url":"https://api.github.com/repos/facebook/react-native/issues/13097/events","html_url":"https://github.com/facebook/react-native/issues/13097","id":216240890,"number":13097,"title":"[PermissionsAndroid] request is not prompting and always return true","user":{"login":"Blapi","id":3853597,"avatar_url":"https://avatars2.githubusercontent.com/u/3853597?v=3","gravatar_id":"","url":"https://api.github.com/users/Blapi","html_url":"https://github.com/Blapi","followers_url":"https://api.github.com/users/Blapi/followers","following_url":"https://api.github.com/users/Blapi/following{/other_user}","gists_url":"https://api.github.com/users/Blapi/gists{/gist_id}","starred_url":"https://api.github.com/users/Blapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blapi/subscriptions","organizations_url":"https://api.github.com/users/Blapi/orgs","repos_url":"https://api.github.com/users/Blapi/repos","events_url":"https://api.github.com/users/Blapi/events{/privacy}","received_events_url":"https://api.github.com/users/Blapi/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2017-03-22T23:40:46Z","updated_at":"2017-04-04T16:01:23Z","closed_at":null,"body":"### Description\r\n\r\nI want to use the camera in my react-native application on Android. For this, I'm using the Camera from https://github.com/lwansbrough/react-native-camera.\r\n\r\nSo, in order to this, i'm using PermissionsAndroid to make sure that the user has the access to the camera. Here comes my problem.\r\n\r\nI'm using the code from the doc (here https://facebook.github.io/react-native/docs/permissionsandroid.html) to do the request permission on camera and I'm having an issue with this as it never asks me to allow the camera and always returns true, even if I disable the camera permission on my device.\r\n\r\nHere is the scenario when camera permission access is granted :\r\n\r\n![17474142_10213255883420181_780649716_o](https://cloud.githubusercontent.com/assets/3853597/24225340/211ad1e2-0f1d-11e7-904a-83655c7b083f.png)\r\n![17455229_10213255883380180_703171875_o](https://cloud.githubusercontent.com/assets/3853597/24225338/211a44ac-0f1d-11e7-8c86-6fb807ede6fa.png)\r\n\r\nHere is the scenario when camera permission access is not granted :\r\n\r\n![17475238_10213255884100198_166958326_o](https://cloud.githubusercontent.com/assets/3853597/24225339/211a76b6-0f1d-11e7-870d-edd52e0d7f97.png)\r\n![17475223_10213255884140199_1657109422_o](https://cloud.githubusercontent.com/assets/3853597/24225341/211c3bea-0f1d-11e7-8aee-2087d37d6a44.png)\r\n\r\n### Reproduction\r\n\r\nWhat I'm doing is simply this : \r\n\r\n```\r\nexport async function requestCameraPermission() {\r\n  try {\r\n    const granted = await PermissionsAndroid.request(\r\n      PermissionsAndroid.PERMISSIONS.CAMERA,\r\n      {\r\n        'title': 'Cool Photo App Camera Permission',\r\n        'message': 'Cool Photo App needs access to your camera ' +\r\n                   'so you can take awesome pictures.'\r\n      }\r\n    )\r\n    if (granted === PermissionsAndroid.RESULTS.GRANTED) {\r\n      console.log(\"You can use the camera\")\r\n    } else {\r\n      console.log(\"Camera permission denied\")\r\n    }\r\n  } catch (err) {\r\n    console.warn(err)\r\n  }\r\n}\r\n```\r\n```\r\n  async componentWillMount() {\r\n    await requestCameraPermission() // which always returns \"You can use the camera\" even if I disable camera permission access on my device\r\n  }\r\n```\r\n\r\n### Additional Information\r\n\r\n* React Native version: 0.40\r\n* Platform: Android 7.1.1\r\n* Development Operating System: Linux (Ubuntu 16.04)\r\n* Dev tools: android:minSdkVersion=\"16\" android:targetSdkVersion=\"23\"\r\n\r\nI'm also experiencing this issue using https://github.com/yonahforst/react-native-permissions/ : https://github.com/yonahforst/react-native-permissions/issues/86"},"comment":{"url":"https://api.github.com/repos/facebook/react-native/issues/comments/291547262","html_url":"https://github.com/facebook/react-native/issues/13097#issuecomment-291547262","issue_url":"https://api.github.com/repos/facebook/react-native/issues/13097","id":291547262,"user":{"login":"Blapi","id":3853597,"avatar_url":"https://avatars2.githubusercontent.com/u/3853597?v=3","gravatar_id":"","url":"https://api.github.com/users/Blapi","html_url":"https://github.com/Blapi","followers_url":"https://api.github.com/users/Blapi/followers","following_url":"https://api.github.com/users/Blapi/following{/other_user}","gists_url":"https://api.github.com/users/Blapi/gists{/gist_id}","starred_url":"https://api.github.com/users/Blapi/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Blapi/subscriptions","organizations_url":"https://api.github.com/users/Blapi/orgs","repos_url":"https://api.github.com/users/Blapi/repos","events_url":"https://api.github.com/users/Blapi/events{/privacy}","received_events_url":"https://api.github.com/users/Blapi/received_events","type":"User","site_admin":false},"created_at":"2017-04-04T16:01:23Z","updated_at":"2017-04-04T16:01:23Z","body":"Much thanks @daniel90daniel  !!!!!!\r\n\r\nI did what you did and this is now working perfectly !\r\n\r\nIf some guys are experimenting the same issue, be careful because as I said in my issue, my dev tools are android:minSdkVersion=\"16\" android:targetSdkVersion=\"23\" BUT those are the infos in my AndroidManifest.xml... in my android/app/build.gradle, the targetSdkVersion was 22 and not 23, and putting it to 23, as @daniel90daniel said, makes it work for me now !"}}
{"actor":{"display_login":"Blapi"}}