| java.lang.Object | ||
| ↳ | com.nexmo.sdk.conversation.client.Event | |
| ↳ | com.nexmo.sdk.conversation.client.Image | |
Send an image to a Conversation and handle activity receipts. The following code example shows how to send an image to a Conversation:
conversation.sendImage("imagePath", new ImageSendListener() {
@Override
public void onSuccess(Event image) {
}
@Override
public void onError(NexmoAPIError error) {
}
});
Once the image is uploaded, you will be able to access all 3 representations:
getOriginal()getMedium()getThumbnail() Each ImageRepresentationcan be asynchronously downloaded using
download(ImageRepresentation.TYPE, RequestHandler)
Alternatively, you can use any other 3rd party image handling library to download the
image, based on getUrl()
For listening to incoming/sent messages events, register using
messageEvent()
Note: No payload is supported for images.
Use Text instead for sending text messages.
|
[Expand]
Inherited Constants | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From interface
android.os.Parcelable
| |||||||||||
| Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| public static final Creator<Image> | CREATOR | ||||||||||
|
[Expand]
Inherited Fields | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.nexmo.sdk.conversation.client.Event
| |||||||||||
| Protected Constructors | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| Image(String localPath) | |||||||||||
| Image(String id, Date timestamp) | |||||||||||
| Image(String id, Date timestamp, Member member) | |||||||||||
| Image(String id, Date timestamp, Member member, Conversation conversation) | |||||||||||
| Image(String id, Date timestamp, Member member, Conversation conversation, ImageRepresentation original, ImageRepresentation medium, ImageRepresentation thumbnail) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp, Conversation conversation) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp, Collection<SeenReceipt> seenReceipts) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp, Conversation conversation, Collection<SeenReceipt> seenReceipts) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp, Conversation conversation, ImageRepresentation original, ImageRepresentation medium, ImageRepresentation thumbnail, Collection<SeenReceipt> seenReceipts, Collection<DeliveredReceipt> deliveredReceipts) | |||||||||||
| Image(String id, Date timestamp, Member member, Date deletedTimestamp, Conversation conversation, Collection<SeenReceipt> seenReceipts, Collection<DeliveredReceipt> deliveredReceipts) | |||||||||||
| Image(Image message) | |||||||||||
| Image(Parcel in) | |||||||||||
| Public Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
| int | describeContents() | ||||||||||
| void |
download(ImageRepresentation.TYPE type, RequestHandler downloadListener)
Start downloading an image representation.
| ||||||||||
| boolean | equals(Object o) | ||||||||||
| static Image | fromPush(String senderId, String eventId, JSONObject messageObject) | ||||||||||
| ImageRepresentation | getImageRepresentationByType(ImageRepresentation.TYPE type) | ||||||||||
| ImageRepresentation | getMedium() | ||||||||||
| ImageRepresentation | getOriginal() | ||||||||||
| ImageRepresentation | getThumbnail() | ||||||||||
| EventType | getType() | ||||||||||
| int | hashCode() | ||||||||||
| boolean |
isDownloaded()
Check if THUMBNAIL image representation was already downloaded on local storage.
| ||||||||||
| String | toString() | ||||||||||
| void | writeToParcel(Parcel dest, int flags) | ||||||||||
|
[Expand]
Inherited Methods | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|
From class
com.nexmo.sdk.conversation.client.Event
| |||||||||||
From class
java.lang.Object
| |||||||||||
From interface
android.os.Parcelable
| |||||||||||
Start downloading an image representation. The downloaded image will be cached to local storage. Next time download is called, image will be fetched from local storage, if file still exists.
| type | Any of ORIGINAL,
MEDIUM, or THUMBNAIL |
|---|---|
| downloadListener | The listener in charge of dispatching the completion result.
When onSuccess() is triggered, either the file, or the associated bitmap
can be accessed to update UI:
|
| JSONException |
|---|
Check if THUMBNAIL image representation was already downloaded on local storage.
Path: "storage/emulated/0/AppPackageName/Media/Images/IMG-imageTimestamp-imageRepresentationID-imageRepresentationType.jpg"
Where imageTimestamp is getTimestamp() ,
imageRepresentationID is ImageRepresentation#id and imageRepresentationType is type