New SDK Android Demo
Software architecture description
1.Lock Operate Api:TTLockClient
2.Lock firmware update Api:LockDfuClient
3.Gateway Api:GatewayClient
Android Studio
18
- import lib in build.gradle:
implementation 'com.ttlock:ttlock:3.2.6'
- add permission in manifest:
<uses-permission android:name="android.permission.BLUETOOTH"/>
<uses-permission android:name="android.permission.BLUETOOTH_ADMIN"/>
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
- before call sdk api,make sure bluetooth is enabled.
- init sdk :
TTLockClient.getDefault().prepareBTService(getApplicationContext());
- use api:
TTLockClient.getDefault().startScanLock(new ScanLockCallback() {
@Override
public void onScanLockSuccess(ExtendedBluetoothDevice device) {
}
});
- when Activity finished,you should close SDK service:
TTLockClient.getDefault().stopBTService();