File tree Expand file tree Collapse file tree 4 files changed +25
-0
lines changed
android/src/main/java/com/levelasquez/androidopensettings Expand file tree Collapse file tree 4 files changed +25
-0
lines changed Original file line number Diff line number Diff line change @@ -118,4 +118,7 @@ AndroidOpenSettings.applicationSettings()
118
118
119
119
// Open device info settings menu
120
120
AndroidOpenSettings.deviceInfoSettings()
121
+
122
+ // Open application notification settings menu
123
+ AndroidOpenSettings.appNotificationSettings()
121
124
```
Original file line number Diff line number Diff line change @@ -213,4 +213,22 @@ public void deviceInfoSettings() {
213
213
reactContext .startActivity (intent );
214
214
}
215
215
}
216
+
217
+ @ ReactMethod
218
+ public void appNotificationSettings () {
219
+ Intent intent = new Intent ("android.settings.APP_NOTIFICATION_SETTINGS" ); // Settings.ACTION_APP_NOTIFICATION_SETTINGS
220
+ intent .addFlags (Intent .FLAG_ACTIVITY_NEW_TASK );
221
+ intent .addFlags (Intent .FLAG_ACTIVITY_NO_HISTORY );
222
+
223
+ //for Android 5-7
224
+ intent .putExtra ("app_package" , reactContext .getPackageName ());
225
+ intent .putExtra ("app_uid" , reactContext .getApplicationInfo ().uid );
226
+
227
+ // for Android 8 and above
228
+ intent .putExtra ("android.provider.extra.APP_PACKAGE" , reactContext .getPackageName ()); // Settings.EXTRA_APP_PACKAGE
229
+
230
+ if (intent .resolveActivity (reactContext .getPackageManager ()) != null ) {
231
+ reactContext .startActivity (intent );
232
+ }
233
+ }
216
234
}
Original file line number Diff line number Diff line change @@ -18,4 +18,5 @@ declare module "react-native-android-open-settings" {
18
18
const accessibilitySettings : ( ) => void ;
19
19
const applicationSettings : ( ) => void ;
20
20
const deviceInfoSettings : ( ) => void ;
21
+ const appNotificationSettings : ( ) => void ;
21
22
}
Original file line number Diff line number Diff line change @@ -40,6 +40,8 @@ const applicationSettings = () => RNAndroidOpenSettings.applicationSettings()
40
40
41
41
const deviceInfoSettings = ( ) => RNAndroidOpenSettings . deviceInfoSettings ( )
42
42
43
+ const appNotificationSettings = ( ) => RNAndroidOpenSettings . appNotificationSettings ( )
44
+
43
45
module . exports = {
44
46
generalSettings,
45
47
homeSettings,
@@ -60,4 +62,5 @@ module.exports = {
60
62
accessibilitySettings,
61
63
applicationSettings,
62
64
deviceInfoSettings,
65
+ appNotificationSettings,
63
66
}
You can’t perform that action at this time.
0 commit comments