How to get timestamp of incoming xmpp message?

后端 未结 6 2038
梦谈多话
梦谈多话 2021-02-04 05:05

I am using aSmack library to communicate with remote xmpp server. I am able to send/receive messages, but I want to get timestamp of incoming message.

Could you tell me

6条回答
  •  甜味超标
    2021-02-04 05:50

    For offline message: You will receive message as below:

    Offline StorageHello
    

    You can parse this XML to get stamp attribute under delay tag. This will give you the time on which it is sent from the sender.

    For MAM archived message: You will receive something as below:

    hello
    

    You can parse this XML to get id attribute under archived tag. This will give you the epoch time in microseconds when this message was sent from the sender.

提交回复
热议问题