`import * as DocumentPicker from 'expo-document-picker';
const pickImage = async () => {
const result = await DocumentPicker.getDocumentAsync({
type: ['image/png', 'image/jpeg'],
});
if (result.type === 'success') {
console.log('Selected file:', result.uri);
}
};`
I'm just wondering: do I need to explicitly ask the user for permissions when using DocumentPicker? I know that with expo-image-picker you have to request permissions for camera roll access, but with document-picker it's confusing — when I test the app on my phone, it doesn’t ask for any permission, yet I can still access the files.
Is expo-document-picker handling the permission request automatically? Or should I be doing it manually?
When you're using expo-document-picker , you do not need to request for permission in most of the cases,
The reason is that expo-document-picker uses the systems's native file picker UI, which operates outside your app's permission scop.
In other words, the users explicitly selecting file through a systems dialog, and the OS handles access the file.