3

Is there a way to check if a list of permissions have already been granted in React Native using the PermissionsAndroid API, similar to how PermissionsAndroid.requestMultiple() can be used to request multiple permissions? I'm looking for a method like PermissionsAndroid.checkMultiple() to allow me to check if a list of permissions were already granted.

I would appreciate some suggestions on this.

Abdoul
  • 125
  • 3
  • 8

1 Answers1

0

The simple wrapper would be something like this (not the same thing, but solves the problem):

const checkPermissions = (permissions: Permission[]): Promise<boolean[]> => {
  return Promise.all(permissions.map((p) => PermissionsAndroid.check(p)))
}

let granted = await checkPermissions([
  PermissionsAndroid.PERMISSIONS.CAMERA,
  PermissionsAndroid.PERMISSIONS.RECORD_AUDIO
])
console.log(granted) // [false,false]
user18309290
  • 5,777
  • 2
  • 4
  • 22