How to use the react-native-permissions.getPermissionStatus 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 EdgeApp / edge-login-ui / src / web / lib / native / permissions.js View on Github external
export async function checkReadContactPermission (callback) {
  try {
    Permissions.getPermissionStatus('contacts').then(response => {
      let granted = false
      if (response === 'authorized') {
        granted = true
      }
        // response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
      return callback(null, granted)
    })
  } catch (err) {
    console.error(err)
    callback(err, null)
  }
}
github EdgeApp / edge-login-ui / src / web / lib / native / permissions.js View on Github external
export async function checkCameraPermission (callback) {
  try {
    Permissions.getPermissionStatus('camera').then(response => {
      let granted = false
      if (response === 'authorized') {
        granted = true
      }
        // response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
      return callback(null, granted)
    })
  } catch (err) {
    console.error(err)
    callback(err, null)
  }
}
github UCSD / campus-mobile / app / containers / geoLocationContainer.js View on Github external
checkLocationPermission() {
		const { dispatch } = this.props;

		// preload permission and dispatch immediately
		Permissions.getPermissionStatus('location')
		.then(response => {
			dispatch(setPermission(response));
			if (response !== 'authorized') {
				this.getPermission();
			}
		});
	},
github ugiacoman / react-native-broadcast / index.ios.js View on Github external
componentDidMount() {
    Permissions.getPermissionStatus('camera')
      .then(response => {
        //response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
        console.log('permissions response', response)
        if (response === 'authorized' ){
          console.log("camera authorized")
        } else {
          this._requestCamera()
        }
      });
    Permissions.getPermissionStatus('microphone')
      .then(response => {
        //response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
        console.log('micro response', response)
        if (response === 'authorized' ){
          console.log("yay")
        } else {
github ugiacoman / react-native-broadcast / index.ios.js View on Github external
componentDidMount() {
    Permissions.getPermissionStatus('camera')
      .then(response => {
        //response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
        console.log('permissions response', response)
        if (response === 'authorized' ){
          console.log("camera authorized")
        } else {
          this._requestCamera()
        }
      });
    Permissions.getPermissionStatus('microphone')
      .then(response => {
        //response is one of: 'authorized', 'denied', 'restricted', or 'undetermined'
        console.log('micro response', response)
        if (response === 'authorized' ){
          console.log("yay")
        } else {
          this._requestMicrophone()
        }
      });
      console.log("trying to start")

  }
  _toggleLive = () => {
github mikelambert / dancedeets-monorepo / mobile / js / util / geo.js View on Github external
export async function hasLocationPermission() {
  const status = await Permissions.getPermissionStatus('location');
  return status === Permissions.StatusAuthorized;
}