Skip to content

Latest commit

 

History

History
50 lines (43 loc) · 1.21 KB

README.en.md

File metadata and controls

50 lines (43 loc) · 1.21 KB

NewSDKAndroidDemo

Description

New SDK Android Demo

Software Architecture:

Software architecture description
1.Lock Operate Api:TTLockClient
2.Lock firmware update Api:LockDfuClient
3.Gateway Api:GatewayClient

IDE

Android Studio

Minimum SDK Version

18

Installation

  1. import lib in build.gradle:
implementation 'com.ttlock:ttlock:3.2.6'
  1. 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"/>

Instructions

  1. before call sdk api,make sure bluetooth is enabled.
  2. init sdk :
 TTLockClient.getDefault().prepareBTService(getApplicationContext());
  1. use api:
TTLockClient.getDefault().startScanLock(new ScanLockCallback() {
    @Override
    public void onScanLockSuccess(ExtendedBluetoothDevice device) {

    }
});
  1. when Activity finished,you should close SDK service:
TTLockClient.getDefault().stopBTService();