Difference between Permissions and Camera.requestPermissionsAsync

The Expo docs for expo-camera state that Camera requires Permissions.Camera. But I don’t see in the example expo-permissions being imported or used. Does Camera.requestPermissionsAsync import this under the hood?

Hey @dedicatedmanagers, we’ve deprecated the expo-permissions module in favor of scoping the required permissions to the specific module. So moving forward, you’ll use the Camera.get/requestPermisssionsAsync methods.

1 Like

Thanks much!

Did I miss somewhere in the documentation that the Permissions was deprecated?

I don’t see it noted on this page (but I could easily be missing it):
https://docs.expo.dev/versions/v38.0.0/sdk/permissions/

Hi

You’re looking at the SDK 38 docs for the Permissions module, although it seems it’s been removed from the docs for SDK >= 40.

The SDK 42 release notes do mention it:

expo-permissions has been removed from react-native-unimodules.

The expo-permissions library was deprecated in SDK 41 in favor of module specific permissions requesters, eg: Camera.requestPermissionsAsync() .

So does this mean that I will now have to build a way to handle taking pictures using the new Camera module from scratch? Currently, I just check for permissions with expo-permissions and then use the expo-image-picker for both media library and camera default OS functions (ImagePicker.launchImageLibraryAsync and ImagePicker.launchCameraAsync). Pretty easy, I let the OS handle taking the pictures and/or picking them and I get the results to handle them.

No, you can still use ImagePicker.launchImageLibraryAsync() and ImagePicker.launchCameraAsync() exactly as before. It just means that instead of using Permissions.askAsync(Permissions.CAMERA) you should now use Camera.requestPermissionsAsync() and instead of using Permissions.getAsync(Permissions.CAMERA) you use Camera.getPermissionsAsync().

So that’s what feels weird to me: having to install a new camera package (expo-camera) just for permissions? Would it not be better to use the permission methods inside image picker (ImagePicker.requestMediaLibraryPermissionsAsync and ImagePicker.requestCameraPermissionsAsync)? This way I basically have a full camera roll and camera solution made with only using the expo-image-picker package…

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