react-native-volume
A react-native bridge for controlling media volume on Android.
Instalation
android/settings.gradle
include ':react-native-volume'
project(':react-native-volume').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-volume/android')
android/app/build.gradle
dependencies {
...
compile project(':react-native-volume')
}
MainActivity.java
On top, where imports are:
Under .addPackage(new MainReactPackage())
:
.
MainApplication.java
Note: In react-native >= 0.29.0 you have to edit MainApplication.java (react-native >= 0.29.0)
On top, where imports are:
Under .addPackage(new MainReactPackage())
:
.
Usage
; // Get the maximum value for the media streamconst maxVolume = ;console; // Get the current volume level as integer, returns a promise; // Set the current volume, (doesn't show system popup); // Listen to volume changes;