How to use the react-native-permissions.checkMultiple function in react-native-permissions

To help you get started, we’ve selected a few react-native-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github square / react-native-square-reader-sdk / reader-sdk-react-native-quickstart / app / screens / SplashScreen.js View on Github external
window.setTimeout(async () => {
      const { navigate } = this.props.navigation;
      try {
        const permissions = await Permissions.checkMultiple(['microphone', 'location']);

        if (Platform.OS === 'ios' // Android doesn't need to handle permission explicitly
            && (permissions.microphone !== 'authorized'
              || permissions.location !== 'authorized')) {
          this.props.navigation.navigate('PermissionSettings');
          return;
        }

        const isAuthorized = await isAuthorizedAsync();
        if (!isAuthorized) {
          navigate('Auth');
          return;
        }

        // Permission has been granted (for iOS only) and readerSDK has been authorized
        this.props.navigation.navigate('Checkout');
github squatsandsciencelabs / OpenBarbellApp / app / utility / VideoPermissionsUtils.js View on Github external
return new Promise(async (resolve, reject) => {
        Permissions.checkMultiple(['camera', 'photo', 'microphone']).then(response => {
            // Response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
            const isCameraAuthorized = response.camera === 'authorized';
            const isMicrophoneAuthorized = response.microphone === 'authorized';
            const isStorageAuthorized = response.photo === 'authorized';
            if (isCameraAuthorized && isMicrophoneAuthorized && isStorageAuthorized) {
                resolve();
            } else {
                Alert.alert(
                    'Additional Permissions Required',
                    recordingPermissionsErrorMessage(isCameraAuthorized, isMicrophoneAuthorized, isStorageAuthorized),
                    [{text: 'OK'}],
                    { cancelable: false }
                );
                // TODO: should put it in the catch so can pass in state
                Analytics.logEvent('record_video_permissions_warning', {});
                reject();
github react-native-community / react-native-permissions / example / App.js View on Github external
checkAllPermissions = () => {
    RNPermissions.checkMultiple(platformPermissions)
      .then(statuses => {
        console.log(statuses);
        this.setState({ statuses });
      })
      .catch(error => {
        console.error(error);
      });
  };
github LiskHQ / lisk-mobile / src / components / send / form / scanner.js View on Github external
checkPermissions = () => {
    Permissions.checkMultiple(['camera', 'photo']).then((response) => {
      this.setPermissions(response);
    });
  }
github square / react-native-square-reader-sdk / reader-sdk-react-native-quickstart / app / screens / PermissionScreenIOS.js View on Github external
async checkPermissionsAndNavigateAsync() {
    try {
      const permissions = await Permissions.checkMultiple(['microphone', 'location']);
      if (permissions.microphone === 'authorized' && permissions.location === 'authorized') {
        this.props.navigation.navigate('Splash');
        return true;
      }
      this.updateMicrophoneState(permissions.microphone);
      this.updateLocationState(permissions.location);
      return false;
    } catch (ex) {
      Alert.alert('Permission Error', ex.message);
      return true;
    }
  }
github react-native-community / react-native-permissions / example / App.js View on Github external
updatePermissions = (types: string[]) => {
    Permissions.checkMultiple(types)
      .then(status => {
        if (this.state.isAlways) {
          return Permissions.check('location', 'always').then(location => ({
            ...status,
            location,
          }));
        }
        return status;
      })
      .then(status => this.setState({status}));
  };
github LiskHQ / lisk-mobile / src / components / shared / scanner / index.js View on Github external
checkPermissions = () => {
    Permissions.checkMultiple(['camera', 'photo']).then(response => {
      this.setPermissions(response);
    });
  };