Domanda

Come inviare invito a contatto con gtalk libreria Java schiaffo?

È stato utile?

Soluzione

//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);

Per ulteriori informazioni guardare questa pagina: http: //www.igniterealtime .org / costruisce / schiaffo / docs / 3.1.0 / javadoc / org / Jive Software / schiaffo / Roster.html

Altri suggerimenti

Usando il codice qui sotto, si può costruire il contatto con GTalk.

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");  

È possibile ottenere Gtalk contatto come segue:

GoogleTalkConnection con = new GoogleTalkConnection();
con.login(”joesmith”, “password”);
con.createChat(”maryjane@gmail.com”).sendMessage(”Howdy!”);
con.close();
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top