📜  rnimagepicker 错误 这个库不需要 Manifest.permission.CAMERA,如果你在清单中添加这个权限,那么你必须获得相同的权限. - 无论代码示例

📅  最后修改于: 2022-03-11 14:55:49.459000             🧑  作者: Mango

代码示例1
const requestCameraPermission = async () => {
  try {
    const granted = await PermissionsAndroid.request(
      PermissionsAndroid.PERMISSIONS.CAMERA,
      {
        title: "App Camera Permission",
        message:"App needs access to your camera "
        buttonNeutral: "Ask Me Later",
        buttonNegative: "Cancel",
        buttonPositive: "OK"
      }
    );
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
      console.log("Camera permission given");
    } else {
      console.log("Camera permission denied");
    }
  } catch (err) {
    console.warn(err);
  }
};