powered by Jive Software

Presence with Google Talk

Hi I have the following code. I can get the roster for a google user, but Presence is always null. Is there anything else I need to do?

GoogleTalkConnection con = new GoogleTalkConnection();

con.login(“name”, “pwd”);

        con.createChat("someone@gmail.com").sendMessage("Hi.");

Roster roster = con.getRoster();

for (Iterator i=roster.getEntries(); i.hasNext(); ) {

RosterEntry re = (RosterEntry)i.next();

System.out.println(re.getName() + " ::::: " +re.getUser());

System.out.println(roster.getPresence(re.getUser()));

}

thanks

Ok its working. Apparently I wasnt waiting long enough.

How did you go about solving the problem? I’‘m just using sleep(500); and it seems to work, but I wonder if there’'s a better way

Hi, I’‘m new here to these message boards, and Smack also. But I’‘m in the process of writing a limited chat client that fits into a bigger application, and I’‘ve been using Smack. I have used practically the exact same code as the example above, and I’‘m getting a null presence back for each entry on my roster, even though that particular roster entry is currently logged in (verified through the admin console). If the presence changes for roster entries subsequently, I receive those notifications alright, and the presence is duly retrieved. But I would like to hear about any solutions regarding the .getPresence function of the Presence class. It’‘s bugging me that it’'s not working!