$ npm install react-native-alarm-clock --save
or
$ yarn add react-native-alarm-clock
$ react-native link react-native-alarm
- Open up
android/app/src/main/java/[...]/MainActivity.java
- Add
import com.liang.RNAlarmClockPackage;
to the imports at the top of the file - Add
new RNAlarmClockPackage()
to the list returned by thegetPackages()
method
- Append the following lines to
android/settings.gradle
:include ':react-native-alarm-clock' project(':react-native-alarm-clock').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-alarm-clock/android')
- Append the following line inside the dependencies block in
android/app/build.gradle
:compile project(':react-native-alarm-clock')
import RNAlarmClock from 'react-native-alarm-clock';
// Creates an alarm with the TAG iDream at 17:30 hrs.
RNAlarm.createAlarm('iDream', 17, 30);