Hi, it’'s possible to know if a message has sent to a specific person ok??
Thanks in advance
Hi, it’'s possible to know if a message has sent to a specific person ok??
Thanks in advance
Sure, take a look at the MessageEventNotificationListener Interface and have a look at the extended documentation. It gives full examples of how to use it
Jon
I’‘ve used this code, but I don’'t receive any notification message.
Could you tell me why not?
Thanks in advance
/*************/
/* Main code */
/*************/
XMPPConnection.DEBUG_ENABLED = true;
conIM = IMUtil.getConnectionIM();
conIM = IMUtil.login(conIM, nickNameFrom, password);
MessageEventManager messageEventManager = new MessageEventManager(conIM);
MessageListener messageListener = new MessageListener();
messageEventManager.addMessageEventNotificationListener(messageListener);
Chat chat1 = conIM.createChat(nickNameTo);
Message msg = chat1.createMessage();
msg.setBody(message);
MessageEventManager.addNotificationsRequests(msg, true, true, true, true);
chat1.sendMessage(msg);
while(!messageListener.isNotified()){
// I never exit from this loop
}
/* close connection */
/*****************/
/* Listener code */
/*****************/
public class MessageListener implements MessageEventNotificationListener {
private boolean notified = false;
public boolean isNotified() {return notified;}
public void deliveredNotification(String from, String packetID) {
this.notified = true;
}
public void displayedNotification(String from, String packetID) {
this.notified = true;
}
public void composingNotification(String from, String packetID) {
this.notified = true;
}
public void offlineNotification(String from, String packetID) {
this.notified = true;
}
public void cancelledNotification(String from, String packetID) {
this.notified = true;
}
}
The only notification I’‘ve received it’'s ‘‘composing’’ using PSI client.
Message was edited by: RAR
This is an extension (jabber:x:event, JEP-22), so it has to be supported by the other’'s client (for displayed and composing) and server (for offline and delivered).
Thank you very much !!!