public class NexmoCustomEvent extends NexmoEvent
Represents a custom event, dispatched into NexmoCustomEventListener
.
Send custom event:
conversation.sendCustomEvent(eventType, data, new NexmoRequestListener() { public void onSuccess(@Nullable Void p0) { Log.d("NexmoRequestListener", "Custom event sent"); } public void onError(@NotNull NexmoApiError apiError) { Log.d("NexmoRequestListener", "Custom event error"); } });
Receive for custom events:
conversation.addCustomEventListener(new NexmoCustomEventListener() { @Override public void onCustomEvent(NexmoCustomEvent event) { Log.d("NexmoCustomEvent", "Incoming custom event of type " + event.getCustomType() + ": " + event.getData()); } });
Retrieve custom 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 NexmoCustomEvent) { // custom event } } } @Override public void onError(@NonNull NexmoApiError apiError) { } });
CREATOR
Modifier | Constructor and Description |
---|---|
|
NexmoCustomEvent(CustomEvent coreEvent,
java.lang.String fromMemberId,
NexmoEventEmbeddedInfo eventEmbeddedInfo,
NexmoConversation conversation) |
protected |
NexmoCustomEvent(android.os.Parcel in) |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(java.lang.Object o) |
java.lang.String |
getCustomType() |
java.util.HashMap |
getData() |
int |
hashCode() |
java.lang.String |
toString() |
describeContents, getConversation, getConversationId, getCreationDate, getEmbeddedInfo, getEventType, getFromMemberId, getId, markEventState, updateEventState, writeToParcel
protected NexmoCustomEvent(android.os.Parcel in)
public NexmoCustomEvent(CustomEvent coreEvent, java.lang.String fromMemberId, NexmoEventEmbeddedInfo eventEmbeddedInfo, NexmoConversation conversation)
public java.lang.String getCustomType()
public java.util.HashMap getData()
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