-
Send Android Intents from React Native code.
-
Specifically check for permission on ExternalStorage after Anrdoid 30.
From Android 30, couple of intents and their flows are necessary to deal with external storage.
** ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
and
** ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
settings
npm install react-native-send-intents
import {
checkPermissionForExternalStorage,
requestPermissionToManageAppAllFiles,
requestPermissionToManageAllFiles
} from 'react-native-send-intents';
// ...
const permissionGranted = await checkPermissionForExternalStorage();
// permissionGranted is boolean - true or false
if (!permissionGranted) {
// If not permissionGranted - request permission
const permissionRequestSucessful = await requestPermissionToManageAppAllFiles('com.sendintentsexample');
// permissionRequestSuccessful is string as returned by the request to
// start the intent ACTION_MANAGE_APP_ALL_FILES_ACCESS_PERMISSION
}
Or , alternatively
if (!permissionGranted) {
// If not permissionGranted - request permission
const permissionRequestSucessful = await requestPermissionToManageAllFiles('com.sendintentsexample');
// permissionRequestSuccessful is string as returned by the request to
// start the intent ACTION_MANAGE_ALL_FILES_ACCESS_PERMISSION
}
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT
Made with create-react-native-library