This thread is archived
3 Replies Last post: Sep 15, 2005 9:35 AM by aoraki  
otherbiz   7 posts since
Aug 26, 2005
Currently Being Moderated

Aug 27, 2005 4:12 PM

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(); ) {

             &n bsp;  RosterEntry re = (RosterEntry)i.next();

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

             &n bsp;  System.out.println(roster.getPresence(re.getUser()));

            }

 

 

thanks

Brian   8 posts since
Aug 29, 2005
Currently Being Moderated
Aug 29, 2005 8:02 PM in response to: otherbiz
Re: Presence with Google Talk

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

aoraki   11 posts since
Sep 15, 2005
Currently Being Moderated
Sep 15, 2005 9:35 AM in response to: Brian
Re: Presence with Google Talk

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!

More Like This

  • Retrieving data ...