订阅了多个主题的AWS IoT消息未到达

时间:2017-10-11 10:39:52

标签: android amazon-web-services mqtt iot aws-iot

连接AWSIotMqttManager时,我订阅了影子主题

mMqttManager.subscribeToTopic("$aws/things/4/shadow/update/delta", AWSIotMqttQos.QOS1, new AWSIotMqttNewMessageCallback() {
        @Override
        public void onMessageArrived(String topic, byte[] data) {
                Log.d("DEBUG", "onMessageArrived: " + topic);
        }
});

mMqttManager.subscribeToTopic("$aws/things/4/shadow/get/accepted", AWSIotMqttQos.QOS1, new AWSIotMqttNewMessageCallback() {
        @Override
        public void onMessageArrived(String topic, byte[] data) {
                Log.d("DEBUG", "onMessageArrived: " + topic);
        }
});

然后发布空消息,为stated in docs

mMqttManager.publishString("", "$aws/things/4/shadow/get", AWSIotMqttQos.QOS1);

我没有回调。

当我删除订阅delta时,我明白了。

为什么呢?如何在app start上订阅两个主题?

0 个答案:

没有答案