Quantcast
Channel: Ignite Realtime : Unanswered Discussions - Support
Viewing all articles
Browse latest Browse all 4979

How to change my status and get status of an user

$
0
0

I using Smack 4.1.1

I make below, but it not working. Someone can help me?

 

// Change status

Presence presence = new Presence(Presence.Type.available);

connection.sendStanza(presence);

 

// Check status

Roster roster = Roster.getInstanceFor(connection);

  try {

  if (!roster.isLoaded()){

  roster.reloadAndWait();

  }

  } catch (NotLoggedInException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  } catch (NotConnectedException e) {

  // TODO Auto-generated catch block

  e.printStackTrace();

  }

Presence presence = roster.getPresence(getUserJID(userId));

return presence.isAvailable();


Viewing all articles
Browse latest Browse all 4979

Trending Articles