I want send composing event in Group (Multiuser) chat in xmpp, I am using asmack library, I have done same functionality with One to One chat.
I am using below code:
mMessageEventManager = new MessageEventManager(XMPPConnectApplication.getInstance().getXmppConnection());
mMessageEventManager.addMessageEventNotificationListener(new MessageEventNotificationListener() {
@Override
public void offlineNotification(String arg0, String arg1) {
}
@Override
public void displayedNotification(String arg0, String arg1) {
}
@Override
public void deliveredNotification(String arg0, String arg1) {
}
@Override
public void composingNotification(String from, String to) {
Log.e("Receiver-composingNotification",from + " is started typing......"+to);
}
@Override
public void cancelledNotification(String from, String to) {
Log.e("Receiver-cancelledNotification",from + " is stopped typing......"+to);
}
});
Please let me know if you have any idea for the same.
Any help will be appreciated.
With RxJava and Jake Wharton's RxBinding, it's quite simple to do:
Remember that we will have to write code to catch these events via smack stanzaListener and display it on the UI accordingly!
Code is written in Kotlin, but it is fairly straight forward.
Usage :
watch this : Quick overview of using
Yes, I have idea about it and I have done just before 1 week.
I have used MessageEventManager to manage Chat States.
Add this method for Chat State Receiving Listener:
Create one Model class name with GroupInfoModel.java:
Now take ArrayList of GroupInfoModel.java class:
on onCreate() of Activity / Fragment:
Now add TextWatcher on your EditText of Compose Message (Chat view) screen:
I strongly recommended that use above code in Application class, you can modify methods as your requirements.
Done.