Frage

Wie Einladung zu gtalk Kontakt mit Smack Java-Bibliothek senden?

War es hilfreich?

Lösung

//Setting up connection
ConnectionConfiguration config = new ConnectionConfiguration("talk.google.com", 5222, "gmail.com");
        connection = new XMPPConnection(config);
        connection.connect();
//login
        connection.login(userName, password);
//get your roster   
    Roster roster = connection.getRoster();
//add a new roster entry aka SEND INVITATION

roster.createEntry(address, name, groups);

Für weitere Details schauen Sie diese Seite: http: //www.igniterealtime .org / Builds / Klaps / docs / 3.1.0 / javadoc / org / Jive Software / Klaps / Roster.html

Andere Tipps

Mit dem folgenden Code können Sie den Kontakt mit gtalk konstruieren.

ConnectionConfiguration conf = new ConnectionConfiguration(  
        "talk.google.com",  
        5222,  
        "gmail.com");  
conf.setSASLAuthenticationEnabled(false);
XMPPConnection con = new XMPPConnection(conf);  
con.connect();  
/* 
 * username : username@gmail.com

 * password : 
 */  
con.login("username", "password");  

Sie können Gtalk Kontakt erreichen Sie wie folgt vor:

GoogleTalkConnection con = new GoogleTalkConnection();
con.login(”joesmith”, “password”);
con.createChat(”maryjane@gmail.com”).sendMessage(”Howdy!”);
con.close();
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top