React Native + Expo - How to ask for permissions for a lib that doesn't provide any RequestPermission helper function?

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 ? …

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


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

SDK Version: 46 ? … expo --version : 6.0.6 (RN 0.69.6)
Platforms(Android/iOS/web/all): Android

Hi @seba99

Yes! That documentation is out of date and does not take into account EAS Build. So if you have a managed Expo app and you are building with EAS Build then you can use PermissionsAndroid.

The following will require prompting the user and you will need to add them to in app.json (although if you are using expo-file-system then the EXTERNAL_STORAGE ones will be automatically added to the permissions array):

The following do not require prompting the user, according to the PermissionsAndroid documentation. If you are using expo-network then ACCESS_WIFI_STATE will be automatically added to the permissions array. Otherwise you’ll have to add it yourself. You’ll also need to add CHANGE_WIFI_STATE to the permissions array:

1 Like

Thanks a lot :slight_smile:

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.