我正在努力解決一個(gè)問題,這個(gè)問題是關(guān)于在 android 的多個(gè)文本視圖中顯示來自代理服務(wù)器的可用 mqtt 主題,并選擇其中一個(gè)來訂閱主題 final MqttAndroidClient client =new MqttAndroidClient(getApplicationContext(),"tcp://iot.eclipse.org:1883","12d45454"); try { client.connect(mqttConnectOptions, null, new IMqttActionListener() { @Override public void onSuccess(IMqttToken mqttToken) { DisconnectedBufferOptions disconnectedBufferOptions = new DisconnectedBufferOptions(); disconnectedBufferOptions.setBufferEnabled(true); disconnectedBufferOptions.setBufferSize(100); disconnectedBufferOptions.setPersistBuffer(false); disconnectedBufferOptions.setDeleteOldestMessages(false); Log.i("ERROR ","Topic="+mqttToken.getTopics()); textview1.setText(mqttToken.getTopics()[0]); }
添加回答
舉報(bào)
0/150
提交
取消