androidopenfiresmack

How to get Server time stamp from live messages in Smack 4.1


I am working on group chat app using Smack 4.1. I am able to differentiate between history messages and current messages. but problem is which one to show the user, For example in history messages there is time stamp based on it i can show it to user and can avoid repeating. for current messages there is no time stamp so I am taking device time stamp but device time stamp is different with respect to server.


Solution

  • For server time sync, check this XEP: https://xmpp.org/extensions/xep-0202.html and as per openfire supported XEP's document, this XEP is available in Openfire.

    You can send an IQ with specified name space to your XMPP Server and in response you get time of server, now you can calculate time difference accordingly