Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
onPress={async () => {
try {
const result = await IntentLauncher.startActivityAsync(
activityAction,
intentParams
);
ToastAndroid.show(
`Activity finished: ${JSON.stringify(result)}`,
ToastAndroid.SHORT
);
} catch (e) {
ToastAndroid.show(
`An error occurred: ${e.message}`,
ToastAndroid.SHORT
);
}
}}
title={title}
onPress: async () => {
if (Platform.OS === 'android') {
const { manifest: { android: { package: packageName } = {} } = {} } = Constants;
try {
await IntentLauncher.startActivityAsync(
IntentLauncher.ACTION_APPLICATION_DETAILS_SETTINGS,
{ data: 'package:' + packageName }
);
} catch (error) {
alert(`Couldn't open settings automatically.`);
}
} else {
await Linking.openURL('app-settings:');
}
resolve(false);
},
},