App SDK initialization description
Android SDK Initialization
1.The License get from SDK should be configured in AndroidManifest.xml
and pass in with meta-data
format.
<application>
<meta-data
android:name="LET_LICENSE"
android:value="Your_License" />
<meta-data
android:name="LET_CHANNEL"
android:value="" />
......
</application>
- Certain parameters are required to be configured before initialization. Default values will be used if they are not configured.
public class BLApplcation extends Application{
@Override
public void onCreate() {
super.onCreate();
sdkInit();
}
/**
* Initialization function of APPSDK
*/
private void sdkInit(){
// Configure parameter class
BLConfigParam blConfigParam = new BLConfigParam();
// 1. Set log level. The default value is 4 for printing all
blConfigParam.put(BLConfigParam.CONTROLLER_LOG_LEVEL, "4");
// 2. Set bottom layer log printing level. The default value is 4 for printing all
blConfigParam.put(BLConfigParam.CONTROLLER_JNI_LOG_LEVEL, "4");
// 3. Set log saving path. The default path is in ../let/directory
// blConfigParam.put(BLConfigParam.SDK_FILE_PATH, "");
// 4. Set local control timeout. The default value is 3000ms
blConfigParam.put(BLConfigParam.CONTROLLER_LOCAL_TIMEOUT, "3000");
// 5. Set remote control timeout. The default value 5000ms
blConfigParam.put(BLConfigParam.CONTROLLER_REMOTE_TIMEOUT, "5000");
// 6. Set control retry times. The default value is 1.
blConfigParam.put(BLConfigParam.CONTROLLER_SEND_COUNT, "1");
// 7. Set device control supported network mode. The default value is -1 for supporting all 0 - Local control only, Not 0 - Local/remote control
blConfigParam.put(BLConfigParam.CONTROLLER_NETMODE, "-1");
// 8. Set resource downloading platform for script and UI The default value is 0 for legacy platform 1- New platform
blConfigParam.put(BLConfigParam.CONTROLLER_SCRIPT_DOWNLOAD_VERSION, "1");
// 9. Batch query of minimal device numbers with online state
blConfigParam.put(BLConfigParam.CONTROLLER_QUERY_COUNT, "8");
// 10. Use APPService. This feature is designed for new cluster. If you are using legacy cluster, please set the value as 0.
blConfigParam.put(BLConfigParam.APP_SERVICE_ENABLE, "1");
// Initialize core library
BLLet.init(this, blConfigParam);
// Get lid and companyId after initialization and use them for initialization for other libraries
String lid = BLLet.getLicenseId();
String companyId = BLLet.getCompanyid();
// Initialize home library
BLFamily.init(companyId, lid);
// Initialize account library
BLAccount.init(companyId, lid);
// Initialize IR code library
BLIRCode.init(lid, blConfigParam);
// Add callback function for successful login
BLAccount.addLoginListener(BLLet.Controller.getLoginListener());
BLAccount.addLoginListener(BLFamily.getLoginListener());
BLAccount.addLoginListener(BLIRCode.getLoginListener());
}
}
iOS SDK Initialization
You need to pass in the obtained License
during initialization of SDK for iOS and configure related parameters as follows:
- (void)loadAppSdk {
//BLLetCore
self.let = [BLLet sharedLetWithLicense:SDK_LICENSE]; // Init APPSDK
[self.let setDebugLog:BL_LEVEL_ALL]; // Set APPSDK debug log level
[self.let.controller setSDKRawDebugLevel:BL_LEVEL_ALL]; // Set DNASDK debug log level
self.let.configParam.controllerSendCount = 1;
self.let.configParam.controllerLocalTimeout = 3000;
self.let.configParam.controllerRemoteTimeout = 5000;
self.let.configParam.controllerQueryCount = 8;
self.let.configParam.controllerScriptDownloadVersion = 1;
// Use APPService for new cluster. If you are using legacy cluster, please set it as 0.
self.let.configParam.appServiceEnable = 1;
[self.let.controller startProbe:3000]; // Start probe device
self.let.controller.delegate = self;
NSString *licenseId = self.let.configParam.licenseId;
NSString *companyId = self.let.configParam.companyId;
//BLLetAccount
self.account = [BLAccount sharedAccount];
//BLLetFamily
self.familyController = [BLFamilyController sharedManager];
//BLLetIRCode
self.ircode = [BLIRCode sharedIrdaCode];
}