Skip to content

Commit

Permalink
Add sound settings
Browse files Browse the repository at this point in the history
  • Loading branch information
zeemyself committed Feb 12, 2020
1 parent 31865e6 commit 5970d42
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,7 @@ AndroidOpenSettings.deviceInfoSettings()
// Open application notification settings menu
AndroidOpenSettings.appNotificationSettings()
// Open sound settings menu
AndroidOpenSettings.soundSettings()
```
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public void generalSettings() {
reactContext.startActivity(intent);
}
}

@ReactMethod
public void homeSettings() {
Intent intent = new Intent(Settings.ACTION_HOME_SETTINGS);
Expand Down Expand Up @@ -231,4 +231,14 @@ public void appNotificationSettings() {
reactContext.startActivity(intent);
}
}

@ReactMethod
public void soundSettings() {
Intent intent = new Intent(Settings.ACTION_SOUND_SETTINGS);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
intent.addFlags(Intent.FLAG_ACTIVITY_NO_HISTORY);
if (intent.resolveActivity(reactContext.getPackageManager()) != null) {
reactContext.startActivity(intent);
}
}
}
1 change: 1 addition & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ declare module "react-native-android-open-settings" {
const applicationSettings: () => void;
const deviceInfoSettings: () => void;
const appNotificationSettings: () => void;
const soundSettings: () => void;
}
3 changes: 3 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ const deviceInfoSettings = () => RNAndroidOpenSettings.deviceInfoSettings()

const appNotificationSettings = () => RNAndroidOpenSettings.appNotificationSettings()

const soundSettings = () => RNAndroidOpenSettings.soundSettings()

module.exports = {
generalSettings,
homeSettings,
Expand All @@ -63,4 +65,5 @@ module.exports = {
applicationSettings,
deviceInfoSettings,
appNotificationSettings,
soundSettings
}

0 comments on commit 5970d42

Please sign in to comment.