yarn
# npm
npm install @zeemyself/react-native-powermanager --save
# yarn
$ yarn add @zeemyself/react-native-powermanager
$ react-native link @zeemyself/react-native-powermanager
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.zeemyself.powermanager.RNPowermanagerPackage;
to the imports at the top of the file - Add
new RNPowermanagerPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':@zeemyself_react-native-powermanager' project(':@zeemyself_react-native-powermanager').projectDir = new File(rootProject.projectDir, '../node_modules/@zeemyself/react-native-powermanager/android')
- Insert the following lines inside the dependencies block in
android/app/build.gradle
:compile project(':@zeemyself_react-native-powermanager')
import PowerManager from '@zeemyself/react-native-powermanager';
if(PowerManager.isSupported()) {
PowerManager.startPowerManager();
}