设备管理 IOTDM(联通用户专用)-登录参数配置:示例

时间:2024-07-03 16:54:08

示例

保存绑定响应消息携带的参数。

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_DEVI CES ECRET); 
    String haAddress = AgentLiteUtil.get(ConfigName.platformIP); 

    saveGatewayInfo(appId, deviceId, secret, haAddress, null); 
} 

设置登录配置。

1
2
3
4
5
6
7
8
9
private void configLoginPara() { 
    LoginConfig.setConfig(LoginConfig. LOG IN_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"); 
}
support.huaweicloud.com/sdkreference-iot/iot_06_1011.html