Configuring Login Parameters
API Function
This API is used to set the parameters required for device connection.
API Description
1 | public static boolean setConfig(int key, String value);
|
Class
LoginConfig
Parameter Description
| Parameter | Mandatory or Optional | Type | Description |
|---|---|---|---|
| key | Mandatory | int | Configuration items used for device connection.
|
| value | Mandatory | String | Value of each configuration item.
|
Return Value
| Return Value | Description |
|---|---|
| true | Success |
| false | Failure |
Example
Save the parameters carried in the device binding response.
1 2 3 4 5 6 7 8 9 | private void saveBindPara(IotaMessage iotaMsg) {
LogUtil.i(this, TAG, "saveBindParaAndGotoLogin");
String appId = iotaMsg.getString(BindService.BIND_IE_APPID);
String deviceId = iotaMsg.getString(BindService.BIND_IE_DEVICEID);
String secret = iotaMsg.getString(BindService.BIND_IE_DEVICESECRET);
String haAddress = AgentLiteUtil.get(ConfigName.platformIP);
saveGatewayInfo(appId, deviceId, secret, haAddress, null);
}
|
Set the parameters for device connection.
1 2 3 4 5 6 7 8 9 | private void configLoginPara() {
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_DEVICEID, GatewayInfo.getDeviceID());
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_APPID, GatewayInfo.getAppID());
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_SECRET, GatewayInfo.getSecret());
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_IOCM_ADDR, GatewayInfo.getHaAddress());
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_IOCM_PORT, "8943");
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_MQTT_ADDR, GatewayInfo.getHaAddress());
LoginConfig.setConfig(LoginConfig.LOGIN_CONFIG_MQTT_PORT, "8883");
}
|
Last Article: Unbinding a Device
Next Article: (Optional) Configuring the Login Information Encryption Algorithm
Did this article solve your problem?
Thank you for your score!Your feedback would help us improve the website.