aSmack - send packets

// Send message Message message= new Message(); message.setTo('bob@example.com'); message.setBody('Hello, Bob'); message.setType(Message.Type.chat); connection.sendPacket(message); // Send ping Ping ping = new Ping(); connection.sendPacket(ping);
Send message or ping basically the same.
We use ping periodically, when we're idle, to inform server that we're still online.

2 Responses

Hello what is the java version that I have to use in order to compile it.
Hi Mario,
This is part 4 of a series ( http://codepad.co/search/?s=aSmack).
aSmack is Android library for XMPP (chatting protocol), although this part should be run well also for Smack (Java library for XMPP). Of course you need to have aSmack's jar file.
I'm not sure about the minimum version, but it's likely work for Android 2.3 and up.

Write a comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.