question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Permissions weren't granted on Android

See original GitHub issue

I’m testing an app which is using react-native-image-picker on my Android devices. It’s working on iOs, not on Android.

Here’s what I’ve done:

export function getImageFromLibrary () {

  let options = {
    quality: 1.0,
    maxWidth: 500,
    maxHeight: 500,
    storageOptions: {
      skipBackup: true
    }
  };

  return dispatch => {

    dispatch(requestImageFromLibrary())

    return ImagePicker.showImagePicker(options, (response) => {

      let responseObj = {};

      if (response.didCancel || response.error) {
          responseObj = {
            success: false,
            errorMessage: response.error,
            uri: response.uri
          };
          dispatch(receiveImageFromLibraryErr(responseObj));
      }

      else {

        responseObj = {
          success: true,
          uri: response.uri
        };
        dispatch(receiveImageFromLibrary(responseObj));
        // let source = { uri: 'data:image/jpeg;base64,' + response.data };


      }

    });
  }

}
<TouchableOpacity onPress={this.props.getImageFromLibrary}>
            <Text>Choose picture</Text>
</TouchableOpacity>

Here’s what happen:

  • I can tap the Choose picture
  • it opens the “Select a photo” menu
  • whether I tap Take photo or Choose from library, it logs an error “Permissions not granted”

I uninstalled the app / reinstalled it, checked my application permissions in Android settings, but it never ask me for more permissions.

What do I miss? Should I use another module, like https://github.com/yonahforst/react-native-permissions?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

85reactions
kevinmcamposcommented, May 8, 2017

Any lucky on this?

Checkout your AndroidManifest.xml and see if it has these lines of code:

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

This library already handle Android permissions, you don’t need any other permission library for use it.

33reactions
bikalaycommented, Mar 14, 2018

I added

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

and it works for me

Read more comments on GitHub >

github_iconTop Results From Across the Web

Change app permissions on your Android phone - Google Help
On your phone, open the Settings app. · Tap Privacy And then Permission manager. · Tap a permission type. If you allowed or...
Read more >
Error: Permissions not granted... react-native-image-picker
The accepted answer won't work if you are using Android M or API level 23+, You need to ...
Read more >
App permissions were not accepted - Device Tracker Plus
As with any app, during the set-up process we ask you to accept certain app permissions to allow Device Tracker Plus to work....
Read more >
Why are Android permissions granted in groups?
So basically anything that wants to use the device with an elevated privilege has to have explicit permission from the user. Most users,...
Read more >
Solar2D Native | Android | Runtime Permission Support
About Android Runtime Permissions · If the device is running Android 5.1 or lower, permissions are granted on app install. No runtime checks...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found