PubNub android在订阅回调中获取消息元

时间:2016-12-27 20:14:18

标签: android callback publish-subscribe pubnub

我正在查看文档,但我无法知道如何执行此操作。

我知道我可以使用连接对象中的meta来过滤结果,但我想从SubscribeCallback中的overriden message方法中获取元值。我可以这样做吗?

这件事,如果它有任何区别:

@Override
        public void message(PubNub pubnub, PNMessageResult message) {
            // Handle new message stored in message.message
            if (message.getChannel() != null) {
                // Message has been received on channel group stored in
                // message.getChannel()

                //If a chat message, send to chat fragment. If a task being added or deleted, update task fragment accordingly.



            } else {
                // Message has been received on channel stored in
                // message.getSubscription()

                //If a chat message, send to chat fragment. If a task being added or deleted, update task fragment accordingly.



            }

0 个答案:

没有答案