How to ask for permissions for a lib that doesn't provide any RequestPermission helper function?

84 Views Asked by At

I've read the new Expo docs regarding asking permissions ... And It's not clear if you're facing a lib that doesn't provide an helper for permissions !

The only thing I've noticed is in this sentence :

Most permissions are added automatically by libraries that you use in your app either with config plugins or with a package-level AndroidManifest.xml, so you won't often need to use android.permissions to add additional permissions.

Does this mean that we could still use the PermissionAndroid for some custom plugins that doesn't provide a specific requestPermissionFunction() as exo-location does ( Location.requestForegroundPermissionsAsync(); ) ? Despite the warning in the front page of react native website ? ....

enter image description here

I'm trying to use the react-native-wifi-p2p lib and it need those permissions :

"android.permission.ACCESS_COARSE_LOCATION",
"android.permission.ACCESS_WIFI_STATE",
"android.permission.CHANGE_WIFI_STATE",
"android.permission.WRITE_EXTERNAL_STORAGE",
"android.permission.READ_EXTERNAL_STORAGE",

Is it even possible to use this lib with expo ? Any help would be appreciated !

1

There are 1 best solutions below

0
On BEST ANSWER

@Wodin from the expo team helped me on this one

The answer is : YES, we can use the PermissionAndroid from react native.

And add all the permissions in the app.json file at expo.android.permissions = [...] also.

Link to the original answer