ttlock_premise_flutter

Creator: coderz1093

Last updated:

0 purchases

ttlock_premise_flutter Image
ttlock_premise_flutter Images
Add to Cart

Description:

ttlock premise flutter

Developers Email list #
[email protected]
ttlock_flutter #
Config
iOS:

In Xcode project ➜ info ➜ Custom iOS Target Projectes. Add keyPrivacy - Bluetooth Peripheral Usage Description value your description for bluetooth

Android:
AndroidManifest.xml configuration:

Add 'xmlns:tools="http://schemas.android.com/tools"' to
Add 'tools:replace="android:label"' to
Additional permissions:

<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"/>
copied to clipboard

In MainActivity extends FlutterActivity, you need add permissions result to ttlock plugin.
add below code:

@Override
public void onRequestPermissionsResult(int requestCode, String[] permissions, int[] grantResults) {
TtlockFlutterPlugin ttlockflutterpluginPlugin = (TtlockFlutterPlugin) getFlutterEngine().getPlugins().get(TtlockFlutterPlugin.class);
if (ttlockflutterpluginPlugin != null) {
ttlockflutterpluginPlugin.onRequestPermissionsResult(requestCode, permissions, grantResults);
}
}
copied to clipboard
5.If you use premise sdk, you need config lib repository and buildTypes in build.gradle file.like this:
repositories {
flatDir {
dirs 'libs', '..\\..\\..\\android\\libs'
}
}
buildTypes {
release {
minifyEnabled false
shrinkResources false
}
}
copied to clipboard
Ussage
import 'package:ttlock_flutter/ttlock.dart';

// Print TTLock Log
TTLock.printLog = true;

TTLock.controlLock(lockData, TTControlAction.unlock,(lockTime, electricQuantity, uniqueId) {
print('success');
}, (errorCode, errorMsg) {
print('errorCode');
});
copied to clipboard
If you want to get log and set time immediately after unlocking, you can do the following:
void unlockAndGetLogAndSetTime() {

//unlock
TTLock.controlLock(lockData, TTControlAction.unlock,(lockTime, electricQuantity, uniqueId) {
print('success');
}, (errorCode, errorMsg) {
print('errorCode');
});

//get log
TTLock.getLockOperateRecord(TTOperateRecordType.latest, lockData,(operateRecord) {
print('$operateRecord');
}, (errorCode, errorMsg) {
print('errorCode');
});
//set time
int timestamp = DateTime.now().millisecondsSinceEpoch;
TTLock.setLockTime(timestamp, lockData, () {
print('$timestamp');
}, (errorCode, errorMsg) {
print('errorCode');
});
}

copied to clipboard
How to determine the function of a lock
TTLock.supportFunction(TTLockFuction.managePasscode, lockData,(isSupport) {
if (isSupport) {
TTLock.modifyPasscode("6666", "7777", startDate, endDate, lockData,() {
print('success');
}, (errorCode, errorMsg) {
print('errorCode');
});
} else {
print('Not support modify passcode');
}
});
copied to clipboard

License

For personal and professional use. You cannot resell or redistribute these repositories in their original state.

Files In This Product:

Customer Reviews

There are no reviews.