public class NexmoMessageEvent extends NexmoEvent
Send a message to the conversation:
conversation.sendMessage(NexmoMessage.fromText("message payload..."), new NexmoRequestListener<NexmoEvent>() { @Override public void onSuccess(NexmoEvent event) { // Message sent } @Override public void onError(NexmoAPIError apiError) { // apiError.getMessage()); } });
Listen for incoming messages (message events):
conversation.addMessageEventListener().add(new MessageEventListener() { @Override public void onMessageEvent(MessageEvent messageEvent) { // New message received } });
Retrieve message events from conversation:
conversation.getEvents(100, NexmoPageOrder.NexmoMPageOrderAsc, null, new NexmoRequestListener() { @Override public void onSuccess(@Nullable NexmoEventsPage eventsPage) { for (NexmoEvent event : eventsPage.getData()) { if (event instanceof NexmoMessageEvent) { // message event } } } @Override public void onError(@NonNull NexmoApiError apiError) { } });
Modifier and Type | Field and Description |
---|---|
static android.os.Parcelable.Creator<NexmoMessageEvent> |
CREATOR |
Modifier and Type | Method and Description |
---|---|
void |
delete(NexmoRequestListener<java.lang.Void> listener)
Deletes a message event.
|
int |
describeContents() |
boolean |
equals(java.lang.Object o) |
java.util.Map<EMessageState,java.util.List<MemberForMessageStateBundle>> |
getEventState()
Gets the event state of this event.
|
NexmoMessage |
getMessage()
Gets the message payload of this event.
|
int |
hashCode() |
void |
markAsDelivered(NexmoRequestListener listener)
Marks a Message event as delivered.
|
void |
markAsSeen(NexmoRequestListener listener)
Marks a Message event as seen.
|
java.lang.String |
toString() |
void |
updateAsDelivered(java.lang.String memberId,
java.lang.String timestamp)
Updates a Message event as delivered.
|
void |
updateAsSeen(java.lang.String memberId,
java.lang.String timestamp)
Updates a Message event as seen.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
getConversation, getConversationId, getCreationDate, getEmbeddedInfo, getEventType, getFromMemberId, getId, markEventState, updateEventState
public static final android.os.Parcelable.Creator<NexmoMessageEvent> CREATOR
public void delete(NexmoRequestListener<java.lang.Void> listener)
listener
- The request completion listener.public void markAsSeen(NexmoRequestListener listener)
listener
- The request completion listener.public void markAsDelivered(NexmoRequestListener listener)
listener
- The request completion listener.public void updateAsDelivered(java.lang.String memberId, java.lang.String timestamp)
memberId
- The id of the member who has marked the eventtimestamp
- The timestamp of when the member marked the eventpublic void updateAsSeen(java.lang.String memberId, java.lang.String timestamp)
memberId
- The id of the member who has marked the eventtimestamp
- The timestamp of when the member marked the eventpublic java.util.Map<EMessageState,java.util.List<MemberForMessageStateBundle>> getEventState()
public NexmoMessage getMessage()
public java.lang.String toString()
toString
in class NexmoEvent
public boolean equals(java.lang.Object o)
equals
in class NexmoEvent
public int hashCode()
hashCode
in class NexmoEvent
public int describeContents()
describeContents
in interface android.os.Parcelable
describeContents
in class NexmoEvent
public void writeToParcel(android.os.Parcel dest, int flags)
writeToParcel
in interface android.os.Parcelable
writeToParcel
in class NexmoEvent