/react-native-alarm-clock

Set native alarms with ReactNative (Android only)

Primary LanguageJavaMozilla Public License 2.0MPL-2.0

react-native-alarm-clock

Getting started

$ npm install react-native-alarm-clock --save or $ yarn add react-native-alarm-clock

Automatic installation

$ react-native link react-native-alarm

Manual installation

Android

  1. 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 the getPackages() method
  1. 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')
    
  2. Insert the following lines inside the dependencies block in android/app/build.gradle:
      compile project(':react-native-alarm-clock')
    

Usage

import RNAlarmClock from 'react-native-alarm-clock';

// Creates an alarm with the TAG iDream at 17:30 hrs.
RNAlarm.createAlarm('iDream', 17, 30);