Reputation: 1
I am working on chat application using smack api in android. How can i send the Emoticons in between or end of the text of message body using smack? And for received messages also how can i detect that text text has Emoticons some where in the text. I have referred this link http://www.igniterealtime.org/builds/smack/docs/latest/documentation/extensions/xhtml.html
Is this is only way or correct way of sending and receiving the Emoticons?
ISSUE 2: How can i detect that i had lost my connection XMPP server. Can any one had the Idea Please share your ideas
Upvotes: 0
Views: 1429
Reputation: 191
Use this library for emojicons:
https://github.com/rockerhieu/emojicon
remember to do Base64 encoding while you send packets over XMPP. Without Base64 encoding there are chances that the XMPP connection get loss all the time.
Happy coding !! :)
Upvotes: 1
Reputation: 191
You can detect if the XMPP connection has lost using the following listener in Android
connection.addConnectionListener(new ConnectionListener() {
@Override
public void reconnectionSuccessful() {
// TODO Auto-generated method stub
System.out.println("ConnectionListener ==== >>>>> reconnectionSuccessful");
}
@Override
public void reconnectionFailed(Exception arg0) {
// TODO Auto-generated method stub
System.out.println("ConnectionListener ==== >>>>> reconnectionFailed >>> " + arg0.toString());
}
@Override
public void reconnectingIn(int arg0) {
// TODO Auto-generated method stub
System.out.println("ConnectionListener ==== >>>>> reconnectingIn >>> " + arg0);
}
@Override
public void connectionClosedOnError(Exception arg0) {
// TODO Auto-generated method stub
System.out.println("ConnectionListener ==== >>>>> connectionClosedOnError >>>" + arg0.toString());
}
@Override
public void connectionClosed() {
// TODO Auto-generated method stub
System.out.println("ConnectionListener ==== >>>>> connectionClosed");
}
});
Upvotes: 4
Reputation: 410
Your question depends on two main things;
If your users are all using your client you can implement it anyway you like. Another possible method would be to come up with character patterns to place in the message body that would be picked up by a regex pattern searcher, though this would get convoluted if you used more than a few emoticons.
Upvotes: 0