[Android] Fix crash if settings activity cannot be opened
The documentation states this is possible, so make sure we handle such errors. Ref: https://developer.android.com/reference/android/provider/Settings.html#ACTION_APPLICATION_DETAILS_SETTINGS
This commit is contained in:
committed by
Paweł Domas
parent
a3cb081609
commit
292f3ab1bd
@@ -80,7 +80,15 @@ function _alertPermissionErrorWithSettings(trackType) {
|
||||
function _openSettings() {
|
||||
switch (Platform.OS) {
|
||||
case 'android':
|
||||
NativeModules.AndroidSettings.open();
|
||||
NativeModules.AndroidSettings.open().catch(() => {
|
||||
Alert.alert(
|
||||
'Error opening settings',
|
||||
'Please open settings and grant the required permissions',
|
||||
[
|
||||
{ text: 'OK' }
|
||||
]
|
||||
);
|
||||
});
|
||||
break;
|
||||
|
||||
case 'ios':
|
||||
|
||||
Reference in New Issue
Block a user