简体   繁体   中英

How to reset Camera Permission in expo-image-picker?

I have just started to use expo-image-picker but for testing purposes I have denied the camera permissions so many times that I'm not being asked anymore whether I want to allow or deny the permission. I have refreshed, relaunched the app but nothing to do

Sample.js

import {TouchableOpacity} from "react-native";
import React from "react";
import { KeyboardAwareScrollView } from "react-native-keyboard-aware-scroll-view";
import FontAwesome5 from "react-native-vector-icons/FontAwesome5";
import * as ImagePicker from "expo-image-picker";
  
  const Sample = ({ navigation }) => {
  
    const handleUpload = async () => {
      let permissionResult =
        await ImagePicker.requestMediaLibraryPermissionsAsync();
      console.log(permissionResult);
      if (permissionResult.granted === false) {
        alert("Camera access required");
        return;
      }
    };
  
    return (
      <KeyboardAwareScrollView>
          <TouchableOpacity onPress={handleUpload}>
            {image && image.url && (
              <FontAwesome5
                name="camera"
                size={20}
                color="black"
                style={{ marginTop: -20, marginLeft: 200, marginBottom: 30 }}
              />)}
          </TouchableOpacity>
      </KeyboardAwareScrollView>
    );
  };
  
  export default Sample ;

Go to the respective app settings and clear data. It should most likely reset the permissions. You can also try uninstalling the app and reinstalling it.

If you are inquiring about what to do if a user does so (which most likely they won't), you'll have to direct the user to the app's settings page and manually allow the permissions.

You'll need to uninstall and reinstall to receive this prompt again I believe.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM