Note: The demo has been deprecated. The new plugin and demo https://github.com/ttlock/react-native-ttlock
-
$ npm install [email protected] --save
-
$ react-native link react-native-ttlock
- In XCode,Add Key
Privacy - Bluetooth Peripheral Usage Description
Valueyour description for bluetooth
to your project'sinfo
➜Custom iOS Target Projectes
- Run your project (
Cmd+R
)<
Note: If you have installed versions before 1.0.4,please remove TTLock.framework in XCode
- config repositories in
android/build.gradle
:
allprojects {
repositories {
flatDir{
dirs "$rootDir/../node_modules/react-native-ttlock/android/libs"
}
}
}
2.Add permission
<uses-permission android:name="android.permission.VIBRATE" />
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
<uses-permission android:name="android.permission.BLUETOOTH" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
3.Add service
<service android:name="com.ttlock.bl.sdk.service.BluetoothLeService" />
import TtLockModule from 'react-native-ttlock';
TtLockModule.initTTlockApi(uid)