Reputation: 1207
I know XEP-0202 in XMPP to get server utc time but I don't know how to use it with Android SMACK library to fetch server time in application.
Any idea ?
Upvotes: 1
Views: 654
Reputation: 1794
public void GetServerTime(){
if(xmppConnection!=null&&xmppConnection.isConnected())
try {
EntityTimeManager timeManager = EntityTimeManager.getInstanceFor(xmppConnection);
String time = timeManager.getTime("SERVERDOMAIN").getUtc();
Log.d("",""+time);
}catch (Exception e){
Log.d("",""+e);
}
}
while SERVERDOMAIN is your xmpp server url. which you add to make User JID i.e [email protected].
`
chat.xxmpp.com
` will be use as SERVERDOMAIN
Upvotes: 3