开发者社区 问答 正文

IOT LinkKit SDK DeviceRegister问题

问题描述

LinkKit.getInstance().deviceRegister(params, request,IoTCallback(){
public void onResponse(CommonRequest commonRequest, CommonResponse commonResponse) {
 ResponseModel<Map<String, String>> response = new Gson().fromJson(commonResponse.getData(), new TypeToken<ResponseModel<Map<String, String>>>() {
                    }.getType());
                   // response 中的值总是返回同一个设备的数据
}
});

期望结果

期望循环遍历调用deviceRegister时,传入不同的params,回调能返回不同的Device数据。

已尝试的方法

循环遍历调用deviceRegister,传入不同的设备名称和productKey及productSecret,但是无果,永远返回同一个设备数据。

展开
收起
s784838898-35193 2022-09-23 15:52:27 163 分享 版权
1 条回答
写回答
取消 提交回答
  • 已连接设备返回设备信息

    初始化不同参数连接不同设备

    LinkKit.getInstance().init(params, new ILinkKitConnectListener() {

         @Override

         public void onError(AError aError) {

             System.out.println("Init error:" + aError);

         }

         //初始化成功以后的回调。

         @Override

         public void onInitDone(InitResult initResult) {

             System.out.println("Init done:" + initResult);

         }

     });

    2022-09-26 09:36:49
    赞同 展开评论
问答分类:
问答地址: