使用PubNub历史Android API

使用PubNub历史Android API,android,json,pubnub,Android,Json,Pubnub,我使用了publinub.history(channel,true,100,new Callback(){…}方法,并成功地接收了我的上100次对话历史记录。响应如下: [[{"message":"hdjcjcjjckckckckvkckckck","timetoken":14151866297757284},{"message":"nexusS","timetoken":14152599862541295},{"message":"nexusS","timetoken":14152600307

我使用了
publinub.history(channel,true,100,new Callback(){…}
方法,并成功地接收了我的上100次对话历史记录。响应如下:

[[{"message":"hdjcjcjjckckckckvkckckck","timetoken":14151866297757284},{"message":"nexusS","timetoken":14152599862541295},{"message":"nexusS","timetoken":14152600307899119},{"message":"Qmobile","timetoken":14152600563127702},{"message":"qMobile","timetoken":14152600865145050},{"message":"NexusS","timetoken":14152601034959154},{"message":"qMobile","timetoken":14152601234812083}],14151866297757284,14152601234812083]
但问题是,我怎么知道哪条消息属于谁,比如A个人发送:nexusS和B个人发送:Qmobile,那么我怎么知道通过这条消息。就像没有ID或身份号码,我可以知道对话消息属于那个特定的人一样。我正在开发一个想要像skype对话一样分别显示两个用户的对话,在skype对话中,我们可以使用标记名轻松确定


提前感谢。

简单的解决方案是在消息JSON本身中添加senderID。例如:

{"senderID":"usman", "data":{"color":"red","size":"medium","section":4}}
然后你可以在senderID上进行解析。另一种方法是也按频道名称进行隔离。所以你已经知道channelUsman iOS中的所有内容都来自于iOS上的Usman


geremy

感谢您的友好回复。它现在正在工作,我制作了包含字符串IMEI的Json消息。当它登陆Pubnub时,我可以根据IMEI比较轻松识别用户。我正在打开另一个关于历史的新线程问题。