public class NexmoAttachmentEvent extends NexmoEvent
Represents the attachment events dispatched into NexmoMessageEventListener.onAttachmentEvent(com.nexmo.client.NexmoAttachmentEvent)
(currently only images).
The NexmoConversation allows to send the attachment:
conversation.sendAttachment(imageFile, new NexmoRequestListener<NexmoAttachmentEvent>() {
@Override
public void onSuccess(NexmoAttachmentEvent image) {
}
@Override
public void onError(NexmoAPIError error) {
}
});
To receive attachment add NexmoMessageEventListener to NexmoConversation and use
NexmoMessageEventListener.onAttachmentEvent(com.nexmo.client.NexmoAttachmentEvent) callback:
conversation.addMessageEventListener(new NexmoMessageEventListener() {
@Override
public void onTextEvent(@NonNull NexmoTextEvent textEvent) {}
@Override
public void onAttachmentEvent(@NonNull NexmoAttachmentEvent attachmentEvent) {
Log.d("onAttachmentEvent", "NexmoAttachmentEvent received");
// image retrieval
attachmentEvent.getMedium() ;
}
@Override
public void onEventDeleted(@NonNull NexmoDeletedEvent deletedEvent) {}
@Override
public void onSeenReceipt(@NonNull NexmoSeenEvent seenEvent) {}
@Override
public void onDeliveredReceipt(@NonNull NexmoDeliveredEvent deliveredEvent) {}
@Override
public void onTypingEvent(@NonNull NexmoTypingEvent typingEvent) {}
});
Mark attachment event as seen:
attachmentEvent.markAsSeen(new NexmoRequestListener() {
@Override
public void onSuccess() {
}
@Override
public void onError(NexmoAPIError error) {
}
});
Mark attachment event event as delivered:
attachmentEvent.markAsDelivered(new NexmoRequestListener() {
@Override
public void onSuccess() {
}
@Override
public void onError(NexmoAPIError error) {
}
});
Delete attachment event:
attachmentEvent.delete(new NexmoRequestListener() {
@Override
public void onSuccess() {
}
@Override
public void onError(NexmoAPIError error) {
}
});
| Modifier and Type | Field and Description |
|---|---|
static android.os.Parcelable.Creator<NexmoAttachmentEvent> |
CREATOR |
| Modifier and Type | Method and Description |
|---|---|
void |
delete(NexmoRequestListener listener)
Deletes an attachment 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.
|
NexmoImageRepresentation |
getMedium()
Gets medium image size represented by
NexmoImageRepresentation. |
NexmoImageRepresentation |
getOriginal()
Gets original image size represented by
NexmoImageRepresentation. |
NexmoImageRepresentation |
getThumbnail()
Gets thumbnail image size represented by
NexmoImageRepresentation. |
int |
hashCode() |
void |
markAsDelivered(NexmoRequestListener listener)
Mark this event as delivered.
|
void |
markAsSeen(NexmoRequestListener listener)
Marks an Image event as seen.
|
java.lang.String |
toString() |
void |
updateAsDelivered(java.lang.String memberId,
java.lang.String timestamp)
Updates this event as delivered.
|
void |
updateAsSeen(java.lang.String memberId,
java.lang.String timestamp)
Updates an this event as seen.
|
void |
writeToParcel(android.os.Parcel dest,
int flags) |
getConversation, getConversationId, getCreationDate, getEmbeddedInfo, getEventType, getFromMemberId, getId, markEventState, updateEventStatepublic static final android.os.Parcelable.Creator<NexmoAttachmentEvent> CREATOR
public void delete(NexmoRequestListener listener)
listener - The request completion listener.public void markAsSeen(NexmoRequestListener listener)
listener - The request completion listener.public void markAsDelivered(NexmoRequestListener listener)
updateAsDelivered(String, String) should be called.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 NexmoImageRepresentation getOriginal()
NexmoImageRepresentation.public NexmoImageRepresentation getMedium()
NexmoImageRepresentation.public NexmoImageRepresentation getThumbnail()
NexmoImageRepresentation.public java.lang.String toString()
toString in class NexmoEventpublic boolean equals(java.lang.Object o)
equals in class NexmoEventpublic int hashCode()
hashCode in class NexmoEventpublic int describeContents()
describeContents in interface android.os.ParcelabledescribeContents in class NexmoEventpublic void writeToParcel(android.os.Parcel dest,
int flags)
writeToParcel in interface android.os.ParcelablewriteToParcel in class NexmoEvent