产品动态
build.gradle 中添加依赖,如下依赖:dependencies {...implementation 'com.tencent.iot.hub:hub-device-java:x.x.x'}
private String mProductID = "YOUR_PRODUCT_ID";private String mDevName = "YOUR_DEVICE_NAME";private String mDevPSK = "YOUR_DEV_PSK";private String mCertFilePath = null;private String mPrivKeyFilePath = null;TXMqttConnection mqttconnection = new TXMqttConnection(mProductID, mDevName, mDevPSK, new callBack());mqttconnection.connect(options, null);try {Thread.sleep(20000);} catch (InterruptedException e) {// TODO Auto-generated catch blocke.printStackTrace();}mqttconnection.disConnect(null);
文档反馈