Keyguard for React Native (Android only)
A react native module to control the Keyguard.
Setup
npm install react-native-interactable --save
- Link the native library to your project
react-native link react-native-interactable
- Rebuild app from your project root directory
react-native run-android
Usage
/* Keyguard returns a promise when the lockscreen is opened. Android does not provide Keyguard control before 21. The promise will be resolved by default in such cases */ Keyguard
Manual Installation
- update
android/settings.gradle
- update
android/app/build.gradle
- Register module in MainActivity.java or MainApplication.java (depending on your RN version)
- Rebuild and restart package manager
android/settings.gradle
...include ':react-native-keyguard'project(':react-native-keyguard').projectDir = new File(settingsDir, '../node_modules/react-native-keyguard/android')
android/app/build.gradle
...dependencies { ... compile project(':react-native-keyguard')}
- register module on React Native >= 0.30 (in MainApplication.java)
// <--- import
- register module on React Native >= 0.19 and RN < 0.30 (in MainActivity.java)
// <--- import
- register module on React Native < 0.19 (in MainActivity.java)
// <--- import
- Run
react-native run-android
from your project root directory