简体   繁体   中英

Android/Java XMPP smack conversation history

I have a stable xmpp chat implemented with smack library for android. I need to get the conversation history between two users, I found out that I can get the history by sending a raw xml IQ, but I couldn't find a way to do it using smack.

<iq type="get" id="pk1">
  <query xmlns="urn:xmpp:mam:tmp" with="user@domain" queryid="x01">
   <set xmlns="http://jabber.org/protocol/rsm">
    <max>100</max>
   </set>
  </query>
</iq>

Is there any other way I could get the history between two users without unsing a server? Thank you

If you want to keep conversations history and without using server then you need to create local db in your Android App. You will keep track of sender, receiver, time and messageId. This way you can keep conversations history without calling server.

Although this type of history will go if you change your device. That is negative side of it.

如果要在服务器上保存历史记录,则需要使用ODBC将服务器数据库与XMPP服务器数据库连接,以维护所有消息

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM