How do I open the notification settings of the app with a React Native code? I found Linking.openURL('app-settings://'); for iOS. I'm looking for a similar implementation for the Android platform.
Here's the way for both Android and iOS.
import { Platform, Linking } from 'react-native';
import Constants from 'expo-constants';
export const openNotificationSettings = () => {
if (Platform.OS === 'ios') {
const bundleId = Constants?.expoConfig?.ios?.bundleIdentifier ?? '';
return Linking.openURL(`App-Prefs:NOTIFICATIONS_ID&path=${bundleId}`);
}
const packageName = Constants?.expoConfig?.android?.package ?? '';
return Linking.sendIntent('android.settings.APP_NOTIFICATION_SETTINGS', [
{
key: 'android.provider.extra.APP_PACKAGE',
value: packageName,
},
]);
};
If you want to open general app settings you can use: Linking.openSettings() Also, don't forget import { Linking } from 'react-native'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With