项目作者: sieuhuflit

项目描述 :
React native unlock screen and wakeup device for Android
高级语言: Java
项目地址: git://github.com/sieuhuflit/react-native-unlock-device.git
创建时间: 2019-02-01T04:57:12Z
项目社区:https://github.com/sieuhuflit/react-native-unlock-device

开源协议:

下载


react-native-unlock-device

Getting started

$ npm install react-native-react-native-unlock-device --save

Mostly automatic installation

$ react-native link react-native-react-native-unlock-device

Manual installation

Android

  1. Open up android/app/src/main/java/[...]/MainActivity.java
  • Add import com.reactlibrary.RNUnlockDevicePackage; to the imports at the top of the file
  • Add new RNUnlockDevicePackage() to the list returned by the getPackages() method
  1. Append the following lines to android/settings.gradle:
  1. include ':react-native-react-native-unlock-device'
  2. project(':react-native-react-native-unlock-device').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-react-native-unlock-device/android')
  1. Insert the following lines inside the dependencies block in android/app/build.gradle:
  1. compile project(':react-native-react-native-unlock-device')

Add this this AndroidManifest.xml

  1. <uses-permission android:name="android.permission.WAKE_LOCK" ></uses-permission>
  2. <uses-permission android:name="android.permission.DISABLE_KEYGUARD"></uses-permission>

Usage

  1. import RNUnlockDevice from 'react-native-unlock-device';
  2. // TODO: What to do with the module?
  3. RNUnlockDevice.unlock()
  4. .then(() => console.log('Success'))
  5. .catch(error => console.log('Error', error));