Skip to content

Conversation

@riccardonuzz
Copy link
Contributor

I added a note just to make more clear that when using some directories it's necessary to ask for permissions to the operating system (tested on Android)

I added a note just to make more clear that when using some directories it's necessary to ask for permissions to the operating system (tested on Android)
@itinance
Copy link
Owner

itinance commented Nov 2, 2018

Thank you!

@riccardonuzz
Copy link
Contributor Author

I just got a question: documentation says that current usage is limited to the DocumentDirectory inside app but asking for permissions seems to make this library work in every other directory (i read my phone's storage). Is that a documentation error? Didn't try to write a file anyway. Here is the snippet of code that i used:

import { PermissionsAndroid } from 'react-native';

PermissionsAndroid.request(PermissionsAndroid.PERMISSIONS.WRITE_EXTERNAL_STORAGE, {
    title: 'Download',
    message: 'Allow me to download a file.'
}).then(granted => {
    if (granted === PermissionsAndroid.RESULTS.GRANTED) {
        console.log('You can use filesystem');
        readDir(ExternalStorageDirectoryPath).then(result => {
            console.log(result);
        });
    } else {
        console.log('Permission denied');
    }
})
.catch(err => console.warn(err));

@itinance itinance merged commit a8d7f78 into itinance:master Dec 19, 2018
@AbdelkaderOumrani
Copy link

it is not working on android 10 even after asking for permissions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants