Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Open app notification settings in a react native android app?

Tags:

react-native

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.

like image 273
AH. Avatar asked Jun 23 '26 16:06

AH.


2 Answers

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,
    },
  ]);
};
like image 148
GollyJer Avatar answered Jun 25 '26 13:06

GollyJer


If you want to open general app settings you can use: Linking.openSettings() Also, don't forget import { Linking } from 'react-native'

like image 41
Alex Guzhyk Avatar answered Jun 25 '26 14:06

Alex Guzhyk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!