Reputation: 14655
How to send invitation to gtalk contact with smack java library?
Upvotes: 2
Views: 1780
Reputation: 31
You can achieve Gtalk contact as follows:
GoogleTalkConnection con = new GoogleTalkConnection();
con.login(”joesmith”, “password”);
con.createChat(”[email protected]”).sendMessage(”Howdy!”);
con.close();
Upvotes: 0
Reputation: 1
Using the code below, you can construct the contact with gtalk.
ConnectionConfiguration conf = new ConnectionConfiguration(
"talk.google.com",
5222,
"gmail.com");
conf.setSASLAuthenticationEnabled(false);
XMPPConnection con = new XMPPConnection(conf);
con.connect();
/*
* username : [email protected]
* password :
*/
con.login("username", "password");
Upvotes: 0
Reputation: 146
//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);
For further details look this page: http://www.igniterealtime.org/builds/smack/docs/3.1.0/javadoc/org/jivesoftware/smack/Roster.html
Upvotes: 4