I am working on XMPP Open fire i was able to send and receive the Message in Private Chat and also in Room and also able to get Chat History Of Room Chat but not able to get Message History Of Private Chat and i also wants to achieve the Message Archiving in Private Chat and Room Chat For Android.
1 Answers
Private Messaging Archives in XMPP
Private chat history is not stored by default on XMPP servers. Private messages that not yet were delivered to a client are stored as "offline messages", if enabled on the server. As soon as a client reconnects, these are automatically delivered and purged. Your client will receive them like normal messages, except that they will contain a timestamp of their initial transmission.
For a more persistent approach, there is XEP-0136: Message Archiving that never was widely used, or the better (and easier to implement) XEP-0313: Message Archive Management.
Server Support for XEP-0313
For Openfire, there was a patch attached to OF-862 that has been merged in September 2015 and is part of the 4.0 release.
There is also support in ejabberd and prosody, if you take a recent enough version.
In either case you will need to enable archiving for your account on the server.
Client Support for XEP-0313
Depending on the client library you use, it might have support already, or you need to extend it with the appropriate XML extension code.
If you are using Smack (the most widely used Android XMPP library), it is not yet supported out-of-the-box, but the Smack maintainer has a local branch with MAM support, and MAM will be incorporated into the next release.
You will need to instanciate a MamManager
for your connection, and can obtain the archive content by using the queryArchive()
method. In the MAM branch, there is no built-in mechanism to configure the account archiving preferences, but I suppose that will also be fixed in the next release.

- 1,816
- 1
- 26
- 38