diff --git a/src/Camera.js b/src/Camera.js index 3d497e8..673dec2 100644 --- a/src/Camera.js +++ b/src/Camera.js @@ -191,10 +191,18 @@ export default class Camera extends Component { message: this.props.permissionDialogMessage, }); + // On devices before SDK version 23, the permissions are automatically granted if they appear in the manifest, + // so check and request should always be true. + // https://github.com/facebook/react-native-website/blob/master/docs/permissionsandroid.md + const isAuthorized = Platform.Version >= 23 + ? granted === PermissionsAndroid.RESULTS.GRANTED + : granted === true; + this.setState({ - isAuthorized: granted === PermissionsAndroid.RESULTS.GRANTED, - isAuthorizationChecked: true, + isAuthorized, + isAuthorizationChecked: true }); + } else { this.setState({ isAuthorized: true, isAuthorizationChecked: true }); }