Skip to content

Commit

Permalink
Add AppNotification Option on Android (#20)
Browse files Browse the repository at this point in the history
* add AppNotification
* add enum variant for app notification
* add extra app package to intent
  • Loading branch information
JBreidfjord authored Jun 13, 2022
1 parent b851b04 commit 9669000
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ might break in future iOS versions or have your app rejected in the App Store.
| **`ApplicationDetails`** | <code>'application_details'</code> | Show screen of details about a particular application |
| **`ApplicationDevelopment`** | <code>'application_development'</code> | Show settings to allow configuration of application development-related settings |
| **`Application`** | <code>'application'</code> | Show settings to allow configuration of application-related settings |
| **`AppNotification`** | <code>'app_notification'</code> | Show settings to allow configuration of application-specific notifications |
| **`BatteryOptimization`** | <code>'battery_optimization'</code> | Show screen for controlling which apps can ignore battery optimizations |
| **`Bluetooth`** | <code>'bluetooth'</code> | Show settings to allow configuration of Bluetooth |
| **`Captioning`** | <code>'captioning'</code> | Show settings for video captioning |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
import static android.provider.Settings.ACTION_APPLICATION_DEVELOPMENT_SETTINGS;
import static android.provider.Settings.ACTION_APPLICATION_SETTINGS;
import static android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS;
import static android.provider.Settings.ACTION_BLUETOOTH_SETTINGS;
import static android.provider.Settings.ACTION_CAPTIONING_SETTINGS;
import static android.provider.Settings.ACTION_CAST_SETTINGS;
Expand Down Expand Up @@ -52,6 +53,7 @@ public enum AndroidSettings {
ApplicationDetails("application_details", ACTION_APPLICATION_DETAILS_SETTINGS),
ApplicationDevelopment("application_development", ACTION_APPLICATION_DEVELOPMENT_SETTINGS),
Application("application", ACTION_APPLICATION_SETTINGS),
AppNotification("app_notification", ACTION_APP_NOTIFICATION_SETTINGS),
BatteryOptimization("battery_optimization", ACTION_IGNORE_BATTERY_OPTIMIZATION_SETTINGS),
Bluetooth("bluetooth", ACTION_BLUETOOTH_SETTINGS),
Captioning("captioning", ACTION_CAPTIONING_SETTINGS),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package nl.raphael.settings;

import static android.provider.Settings.ACTION_APPLICATION_DETAILS_SETTINGS;
import static android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS;
import static android.provider.Settings.EXTRA_APP_PACKAGE;

import android.content.Intent;
import android.net.Uri;
Expand Down Expand Up @@ -48,6 +50,9 @@ private void openOption(PluginCall call, String setting) {
if (ACTION_APPLICATION_DETAILS_SETTINGS.equals(setting)) {
intent.setAction(setting);
intent.setData(Uri.parse("package:" + getActivity().getPackageName()));
} else if (ACTION_APP_NOTIFICATION_SETTINGS.equals(setting)) { // App notification settings requires package name as extra app package.
intent.setAction(setting);
intent.putExtra(EXTRA_APP_PACKAGE, getActivity().getPackageName());
} else {
intent.setAction(setting);
}
Expand Down
5 changes: 5 additions & 0 deletions src/definitions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,11 @@ export enum AndroidSettings {
*/
Application = 'application',

/**
* Show settings to allow configuration of application-specific notifications
*/
AppNotification = 'app_notification',

/**
* Show screen for controlling which apps can ignore battery optimizations
*/
Expand Down

0 comments on commit 9669000

Please sign in to comment.