If you are using core implementation method, you can use the methods from the TapCoreChatRoomManager and TapCoreMessageManager class to manage chat room and messages.
ParametersGROUP_NAME: (String) name of the group chat room to create
PARTICIPANT_LIST: (List) list of the group participant's user IDs
IMAGE_URI: (Uri) picture to be uploaded as the group's profile
Get Chat Room Data
Get room details from selected room ID.
TapCoreChatRoomManager.getInstance().getChatRoomData(ROOM_ID,newTapCoreGetRoomListener() { @OverridepublicvoidonSuccess(TAPRoomModel room) {// Open chat room here } @OverridepublicvoidonError(String errorCode,String errorMessage) { }});
TapCoreChatRoomManager.getInstance().getChatRoomData(ROOM_ID, object : TapCoreGetRoomListener() {overridefunonSuccess(room: TAPRoomModel?) {// Open chat room here }overridefunonError(errorCode: String?, errorMessage: String?) { }})
ParametersROOM_ID: (String) selected room's ID
Update Group Chat Room Details
Create a new Update existing group chat room data.
ParametersGROUP_ID: (String) room ID of the selected group
IMAGE_URI: (Uri) new picture for the group's profile
Delete Local Group Chat Room
Delete group chat room from the device's local storage and clear all chat data and participants. Locally deleted room data will still be accessible from the server if the user remains a participant in the room.
Parameters
ROOM_ID: (String) ID of the room where the user starts typing in
Send Text Message
To send a text message to a chat room, use the sendTextMessage() method from the TapCoreMessageManager class.
TapCoreMessageManager.getInstance().sendTextMessage(MESSAGE_BODY, ROOM,newTapCoreSendMessageListener() { @OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
TapCoreMessageManager.getInstance().sendTextMessage(MESSAGE_BODY, ROOM, object : TapCoreSendMessageListener() {overridefunonStart(message: TAPMessageModel?) {// Message was constructed }overridefunonSuccess(message: TAPMessageModel?) {// Message was sent successfully }overridefunonError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) { }})
Use the sendTextMessage() method with extra parameter to send a text message with quote.
TapCoreMessageManager.getInstance().sendTextMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
TapCoreMessageManager.getInstance().sendTextMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
overridefunonStart(message: TAPMessageModel?) {// Message was constructed }overridefunonSuccess(message: TAPMessageModel?) {// Message was sent successfully }overridefunonError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) { }})
ParametersMESSAGE_BODY: (String) content of the message
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
Send Location Message
You can send a location embedded in a chat message using sendLocationMessage(). This method takes latitude, longitude, and address text as parameters.
TapCoreMessageManager.getInstance().sendLocationMessage(LATITUDE, LONGITUDE, ADDRESS, ROOM, new TapCoreSendMessageListener() {
@OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
TapCoreMessageManager.getInstance().sendLocationMessage(LATITUDE, LONGITUDE, ADDRESS, ROOM, object : TapCoreSendMessageListener() {
overridefunonStart(message: TAPMessageModel?) {// Message was constructed }overridefunonSuccess(message: TAPMessageModel?) {// Message was sent successfully }overridefunonError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) { }})
Use the sendLocationMessage() method with extra parameter to send a location message with quote.
TapCoreMessageManager.getInstance().sendLocationMessage(LATITUDE, LONGITUDE, ADDRESS, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
TapCoreMessageManager.getInstance().sendLocationMessage(LATITUDE, LONGITUDE, ADDRESS, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
overridefunonStart(message: TAPMessageModel?) {// Message was constructed }overridefunonSuccess(message: TAPMessageModel?) {// Message was sent successfully }overridefunonError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) { }})
ParametersLATITUDE: (Double) latitude of the shared location
LONGITUDE: (Double) longitude of the shared location
ADDRESS: (String) text data containing the location address
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
Send Image Message
To send an image to a chat room, you can use sendImageMessage() method by providing either IMAGE_URI, BITMAP, or IMAGE_URL as parameter.
// Send image with file UriTapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URI, CAPTION, ROOM,newTapCoreSendMessageListener() { @OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonProgress(TAPMessageModel message,int percentage,long bytes) {// Image upload is in progress } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
// Send image with file UriTapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URI, CAPTION, ROOM, object : TapCoreSendMessageListener() {overridefunonStart(message: TAPMessageModel?) {// Message was constructed }overridefunonProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {// Image upload is in progress }overridefunonSuccess(message: TAPMessageModel?) {// Message was sent successfully }overridefunonError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) { }})
// Send image with BitmapTapCoreMessageManager.getInstance().sendImageMessage(BITMAP, CAPTION, ROOM,newTapCoreSendMessageListener() { @OverridepublicvoidonStart(TAPMessageModel message) {// Message was constructed } @OverridepublicvoidonProgress(TAPMessageModel message,int percentage,long bytes) {// Image upload is in progress } @OverridepublicvoidonSuccess(TAPMessageModel message) {// Message was sent successfully } @OverridepublicvoidonError(@NullableTAPMessageModel message,String errorCode,String errorMessage) { }});
// Send image with Bitmap
TapCoreMessageManager.getInstance().sendImageMessage(BITMAP, CAPTION, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// Image upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send image with remote image URL
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URL, CAPTION, ROOM, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send image with remote image URL
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URL, CAPTION, ROOM, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
Use the sendImageMessage() method with extra parameter to send an image message with quote.
// Send image with file Uri
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URI, CAPTION, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// Image upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send image with file Uri
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URI, CAPTION, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// Image upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send image with Bitmap
TapCoreMessageManager.getInstance().sendImageMessage(BITMAP, CAPTION, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// Image upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send image with Bitmap
TapCoreMessageManager.getInstance().sendImageMessage(BITMAP, CAPTION, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// Image upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send image with remote image URL
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URL, CAPTION, ROOM, QUOTED_MESSAGE, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send image with remote image URL
TapCoreMessageManager.getInstance().sendImageMessage(IMAGE_URL, CAPTION, ROOM, QUOTED_MESSAGE, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersIMAGE_URI: (Uri) local Uri of the image file
BITMAP: (Bitmap) bitmap file of the image
IMAGE_URL: (String) remote URL of the image file
CAPTION: (String) caption for the image
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
FETCH_METADATA: (boolean) inserts metadata from remote URL to the constructed message when true
Send Video Message
To send a video to a chat room, you can use sendVideoMessage() method by providing VIDEO_URI or VIDEO_URL.
// Send video with file Uri
TapCoreMessageManager.getInstance().sendVideoMessage(VIDEO_URI, CAPTION, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// Video upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send video with file Uri
TapCoreMessageManager.getInstance().sendVideoMessage(VIDEO_URI, CAPTION, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// Video upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send video with remote video URL
TapCoreMessageManager.getInstance().sendVideoMessage(CONTEXT, VIDEO_URL, CAPTION, ROOM, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send video with remote video URL
TapCoreMessageManager.getInstance().sendVideoMessage(CONTEXT, VIDEO_URL, CAPTION, ROOM, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
Use the sendVideoMessage() method with extra parameter to send a video message with quote.
// Send video with file Uri
TapCoreMessageManager.getInstance().sendVideoMessage(VIDEO_URI, CAPTION, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// Video upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send video with file Uri
TapCoreMessageManager.getInstance().sendVideoMessage(VIDEO_URI, CAPTION, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// Video upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send video with remote video URL
TapCoreMessageManager.getInstance().sendVideoMessage(CONTEXT, VIDEO_URL, CAPTION, ROOM, QUOTED_MESSAGE, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send video with remote video URL
TapCoreMessageManager.getInstance().sendVideoMessage(CONTEXT, VIDEO_URL, CAPTION, ROOM, QUOTED_MESSAGE, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersCONTEXT: (Context) your Application or Activity context
VIDEO_URI: (Uri) local Uri of the video file
VIDEO_URL: (String) remote URL of the video file
CAPTION: (String) caption for the video
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
FETCH_METADATA: (boolean) inserts metadata from remote URL to the constructed message when true
Send File Message
You can also send a file to a chat room using the sendFileMessage() method with a provided FILE, URI, or FILE_URL.
// Send file with File object
TapCoreMessageManager.getInstance().sendFileMessage(FILE, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with File object
TapCoreMessageManager.getInstance().sendFileMessage(FILE, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send file with file Uri
TapCoreMessageManager.getInstance().sendFileMessage(URI, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with file Uri
TapCoreMessageManager.getInstance().sendFileMessage(URI, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send file with remote file URL
TapCoreMessageManager.getInstance().sendFileMessage(FILE_URL, CAPTION, ROOM, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with remote file URL
TapCoreMessageManager.getInstance().sendFileMessage(FILE_URL, CAPTION, ROOM, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
Use the sendFileMessage() method with extra parameters to send a file message with quote and/or caption.
// Send file with File object
TapCoreMessageManager.getInstance().sendFileMessage(FILE, ROOM, QUOTED_MESSAGE, CAPTION, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with File object
TapCoreMessageManager.getInstance().sendFileMessage(FILE, ROOM, QUOTED_MESSAGE, CAPTION, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send file with file Uri
TapCoreMessageManager.getInstance().sendFileMessage(URI, ROOM, QUOTED_MESSAGE, CAPTION, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with file Uri
TapCoreMessageManager.getInstance().sendFileMessage(URI, ROOM, QUOTED_MESSAGE, CAPTION, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Send file with remote file URL
TapCoreMessageManager.getInstance().sendFileMessage(FILE_URL, CAPTION, ROOM, QUOTED_MESSAGE, FILE_NAME, MIME_TYPE, FETCH_METADATA, new TapCoreSendMessageListener() {
@Override
public void onTemporaryMessageCreated(TAPMessageModel message) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Send file with remote file URL
TapCoreMessageManager.getInstance().sendFileMessage(FILE_URL, CAPTION, ROOM, QUOTED_MESSAGE, FILE_NAME, MIME_TYPE, FETCH_METADATA, object : TapCoreSendMessageListener() {
override fun onTemporaryMessageCreated(message: TAPMessageModel?) {
// Temporary message was created while fetching metadata
// This callback will be called when FETCH_METADATA is true
}
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
// onProgress is not called when remote URL is provided
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersFILE: (File) file to be sent, can also be replaced with URIURI: (Uri) path of the file to be sent
FILE_URL: (String) file to be sent, can also be replaced with URICAPTION: (String) caption for the file
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
FETCH_METADATA: (boolean) inserts metadata from remote URL to the constructed message when true
Send Voice Message
You can also send a voice note to a chat room using the sendVoiceMessage() method with a provided FILE or URI.
TapCoreMessageManager.getInstance().sendVoiceMessage(FILE, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().sendVoiceMessage(FILE, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
Use the sendVoiceMessage() method with extra parameter to send a file message with quote.
TapCoreMessageManager.getInstance().sendVoiceMessage(FILE, ROOM, QUOTED_MESSAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onProgress(TAPMessageModel message, int percentage, long bytes) {
// File upload is in progress
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().sendVoiceMessage(FILE, ROOM, QUOTED_MESSAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onProgress(message: TAPMessageModel?, percentage: Int, bytes: Long) {
// File upload is in progress
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersFILE: (File) voice file to be sent, can also be replaced with URIURI: (Uri) path of the file to be sent
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
Send Link Message
You can send a link message, which is usually composed of a text message with URL on the body, using the sendLinkMessage() method.
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, URLS, TITLE, DESCRIPTION, IMAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// With additional metadata parameters
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, URLS, TITLE, DESCRIPTION, IMAGE, SITE_NAME, TYPE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, URLS, TITLE, DESCRIPTION, IMAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// With additional metadata parameters
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, URLS, TITLE, DESCRIPTION, IMAGE, SITE_NAME, TYPE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
Use the sendLinkMessage() method with extra parameters to send a link message with quote.
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, URLS, TITLE, DESCRIPTION, IMAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// With additional metadata parameters
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, URLS, TITLE, DESCRIPTION, IMAGE, SITE_NAME, TYPE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, URLS, TITLE, DESCRIPTION, IMAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// With additional metadata parameters
TapCoreMessageManager.getInstance().sendLinkMessage(MESSAGE_BODY, ROOM, QUOTED_MESSAGE, URLS, TITLE, DESCRIPTION, IMAGE, SITE_NAME, TYPE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE_BODY: (String) content of the message
ROOM: (TAPRoomModel) the destination room where the message will be sent
QUOTED_MESSAGE: (TAPMessageModel) quote containing another existing message
URLS: (List<String>) list of URLs contained in the message
TITLE: (String) og:title metadata of the specified URL
DESCRIPTION: (String) og:description metadata of the specified URL
IMAGE: (String) og:image metadata of the specified URL
SITE_NAME: (String) og:site_name metadata of the specified URL
TYPE: (String) og:type metadata of the specified URL
Forward Message
To forward existing messages to chat room, call the sendForwardedMessage() method. You may also use sendForwardedMessages() to forward multiple messages at once, or sendForwardedMessageToMultipleRooms() or sendForwardedMessagesToMultipleRooms() to forward messages to multiple rooms at once.
// Forward a message
TapCoreMessageManager.getInstance().sendForwardedMessage(MESSAGE_TO_FORWARD, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// New message to be forwarded was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Forward multiple messages at once
TapCoreMessageManager.getInstance().sendForwardedMessageToMultipleRooms(MESSAGES_TO_FORWARD, ROOM, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// New message to be forwarded was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Forward a message to multiple chat rooms
TapCoreMessageManager.getInstance().sendForwardedMessage(MESSAGE_TO_FORWARD, ROOMS, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// New message to be forwarded was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Forward multiple messages to multiple chat rooms at once
TapCoreMessageManager.getInstance().sendForwardedMessagesToMultipleRooms(MESSAGES_TO_FORWARD, ROOMS, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// New message to be forwarded was constructed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
// Forward a message
TapCoreMessageManager.getInstance().sendForwardedMessage(MESSAGE_TO_FORWARD, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// New message to be forwarded was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Forward multiple messages at once
TapCoreMessageManager.getInstance().sendForwardedMessages(MESSAGES_TO_FORWARD, ROOM, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// New message to be forwarded was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Forward a message to multiple chat rooms
TapCoreMessageManager.getInstance().sendForwardedMessageToMultipleRooms(MESSAGE_TO_FORWARD, ROOMS, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// New message to be forwarded was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
// Forward multiple messages to multiple chat rooms at once
TapCoreMessageManager.getInstance().sendForwardedMessagesToMultipleRooms(MESSAGES_TO_FORWARD, ROOMS, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// New message to be forwarded was constructed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(message: TAPMessageModel?, errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE_TO_FORWARD: (TAPMessageModel) existing message to be forwarded
MESSAGES_TO_FORWARD: (List<TAPMessageModel>) list of messages to be forwarded
ROOM: (TAPRoomModel) the destination room where the message will be forwarded
ROOMS: (List<TAPRoomModel>) list of destination rooms where the message will be forwarded
Construct TapTalk.io Message Model
You can construct your own customized message model to be used in chat as shown below.
val customMessageWithQuote =
TapCoreMessageManager.getInstance().constructTapTalkMessageModelWithQuote(
MESSAGE_BODY,
ROOM,
MESSAGE_TYPE.toInt(),
MESSAGE_DATA,
QUOTED_MESSAGE
)
ParametersMESSAGE_BODY: (String) content of the message
ROOM: (TAPRoomModel) the destination room where the message will be sent
MESSAGE_TYPE: (Integer) type of your custom message, check the Message Type page for more information
MESSAGE_DATA: (HashMap<String, Object>) custom data for the message (optional)
QUOTED_MESSAGE: (TAPMessageModel) quote of the new message model containing another existing message
Note: you are free to put any data that you need for your custom message in the MESSAGE_DATAparameter, to obtain message data from a TAPMessageModel, use the TAPMessageModel.getData()method
Send a Custom Message
To send a custom message that you just created above, call the sendCustomMessage() method with the custom message as a parameter.
TapCoreMessageManager.getInstance().sendCustomMessage(CUSTOM_MESSAGE, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message is being processed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was sent successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().sendCustomMessage(CUSTOM_MESSAGE, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message is being processed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersCUSTOM_MESSAGE: (TAPMessageModel) the message to be sent, see the Construct TapTalk.io Message Model section to construct a custom message
Edit Message
To update the contents of a message, you may use the editMessage() method from TapCoreMessageManager class. Editing is currently available for text message and image or video message caption.
TapCoreMessageManager.getInstance().editMessage(MESSAGE_MODEL, UPDATED_TEXT, new TapCoreSendMessageListener() {
@Override
public void onStart(TAPMessageModel message) {
// Message is being processed
}
@Override
public void onSuccess(TAPMessageModel message) {
// Message was edited successfully
}
@Override
public void onError(@Nullable TAPMessageModel message, String errorCode, String errorMessage) {
}
TapCoreMessageManager.getInstance().deleteMessage(MESSAGE_MODEL, UPDATED_TEXT, object : TapCoreSendMessageListener() {
override fun onStart(message: TAPMessageModel?) {
// Message is being processed
}
override fun onSuccess(message: TAPMessageModel?) {
// Message was sent successfully
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE_MODEL: (TAPMessageModel) the message to be updated
UPDATED_TEXT: (String) new text to replace the body and caption of the message
Delete Message
To delete a message permanently from the server, call deleteMessage() from TapCoreMessageManager class. When the message is successfully deleted, TapCoreMessageListener will invoke onMessageDeleted() callback.
ParametersMESSAGE_LOCAL_ID: (String) local ID of the message to delete
Cancel Message File Upload
Messages such as Image, Video, and File messages requires a file upload completion before the message is sent. To cancel an ongoing file upload of a message, call the cancelMessageFileUpload() method.
ParametersMESSAGE: (TAPMessageModel) selected message with ongoing file download
Upload Image
You can upload an image file to TapTalk.io server without sending message. The response will return the uploaded file ID and URL.
TapCoreMessageManager.getInstance(instanceKey).uploadImage(CONTEXT, IMAGE_URI, new TapCoreFileUploadListener() {
@Override
public void onStart(File file, Uri uri) {
// Returns the compressed image file and uri before upload is started
}
@Override
public void onProgress(int percentage, long bytes) {
// File upload in in progress
}
@Override
public void onSuccess(String fileID, String fileURL) {
// Successfully uploaded file
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance(instanceKey).uploadImage(CONTEXT, IMAGE_URI, object : TapCoreFileUploadListener() {
override fun onStart(file: File, uri: Uri) {
// Returns the compressed image file and uri before upload is started
}
override fun onProgress(percentage: Int, bytes: Long) {
// File upload in in progress
}
override fun onSuccess(fileID: String, fileURL: String) {
// Successfully uploaded file
}
override fun onError(errorCode: String, errorMessage: String) {
}
})
ParametersCONTEXT: (Context) your Application or Activity context
IMAGE_URI: (Uri) local Uri of the image file
Upload Video
You can upload a video file to TapTalk.io server without sending message. The response will return the uploaded file ID and URL.
TapCoreMessageManager.getInstance(instanceKey).uploadVideo(CONTEXT, VIDEO_URI, new TapCoreFileUploadListener() {
@Override
public void onStart(File file, Uri uri) {
// Returns the file and uri before upload is started
}
@Override
public void onProgress(int percentage, long bytes) {
// File upload in in progress
}
@Override
public void onSuccess(String fileID, String fileURL) {
// Successfully uploaded file
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance(instanceKey).uploadVideo(CONTEXT, VIDEO_URI, object : TapCoreFileUploadListener() {
override fun onStart(file: File, uri: Uri) {
// Returns the file and uri before upload is started
}
override fun onProgress(percentage: Int, bytes: Long) {
// File upload in in progress
}
override fun onSuccess(fileID: String, fileURL: String) {
// Successfully uploaded file
}
override fun onError(errorCode: String, errorMessage: String) {
}
})
ParametersCONTEXT: (Context) your Application or Activity context
VIDEO_URI: (Uri) local Uri of the video file
Upload File
You can also upload other formats of file/document to TapTalk.io server without sending message. The response will return the uploaded file ID and URL.
TapCoreMessageManager.getInstance(instanceKey).uploadFile(CONTEXT, FILE_URI, new TapCoreFileUploadListener() {
@Override
public void onStart(File file, Uri uri) {
// Returns the file and uri before upload is started
}
@Override
public void onProgress(int percentage, long bytes) {
// File upload in in progress
}
@Override
public void onSuccess(String fileID, String fileURL) {
// Successfully uploaded file
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance(instanceKey).uploadFile(CONTEXT, FILE_URI, object : TapCoreFileUploadListener() {
override fun onStart(file: File, uri: Uri) {
// Returns the file and uri before upload is started
}
override fun onProgress(percentage: Int, bytes: Long) {
// File upload in in progress
}
override fun onSuccess(fileID: String, fileURL: String) {
// Successfully uploaded file
}
override fun onError(errorCode: String, errorMessage: String) {
}
})
ParametersCONTEXT: (Context) your Application or Activity context
FILE_URI: (Uri) local Uri of the file
Mark Message as Delivered
To manually mark a message as delivered, call the markMessageAsDelivered() method.
To manually mark a message as read, call the markMessageAsRead() method. You can also mark multiple messages as read at once using markMessagesAsRead().
// Mark single message as read with message model
TapCoreMessageManager.getInstance().markMessageAsRead(MESSAGE);
// Mark single message as read with message ID
TapCoreMessageManager.getInstance().markMessageAsRead(MESSAGE_ID);
// Mark multiple messages as read with list of message IDs
TapCoreMessageManager.getInstance().markMessagesAsRead(MESSAGE_IDS);
// Mark multiple messages as read with list of message IDs and completion listener
TapCoreMessageManager.getInstance().markMessagesAsRead(MESSAGE_IDS, new TapCoreUpdateMessageStatusListener() {
@Override
public void onSuccess(List<String> updatedMessageIDs) {
// updatedMessageIDs contains message IDs that were successfully marked as read
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Mark single message as read with message model
TapCoreMessageManager.getInstance().markMessageAsRead(MESSAGE)
// Mark single message as read with message ID
TapCoreMessageManager.getInstance().markMessageAsRead(MESSAGE_ID)
// Mark multiple messages as read with list of message IDs
TapCoreMessageManager.getInstance().markMessagesAsRead(MESSAGE_IDS)
// Mark multiple messages as read with list of message IDs and completion listener
TapCoreMessageManager.getInstance().markMessagesAsRead(MESSAGE_IDS, object : TapCoreUpdateMessageStatusListener() {
override fun onSuccess(updatedMessageIDs: List<String>?) {
// updatedMessageIDs contains message IDs that were successfully marked as read
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE: (TAPMessageModel) existing message to be marked as read
MESSAGE_ID: (String) message ID from an existing message to be marked as read
MESSAGE_IDS: (String) message ID from an existing message to be marked as read
Mark All Chat Room Messages as Read
To quickly mark all unread messages in a chat room as read, call markAllMessageInRoomAsRead() method.
// Mark all unread messages in specified chat room as read
TapCoreMessageManager.getInstance().markAllMessagesInRoomAsRead(ROOM_ID);
// Mark all unread messages in specified chat room as read with completion listener
TapCoreMessageManager.getInstance().markAllMessagesInRoomAsRead(ROOM_ID, new TapCoreUpdateMessageStatusListener() {
@Override
public void onSuccess(List<String> updatedMessageIDs) {
// updatedMessageIDs contains message IDs that were successfully marked as read
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Mark all unread messages in specified chat room as read
TapCoreMessageManager.getInstance().markAllMessagesInRoomAsRead(ROOM_ID)
// Mark all unread messages in specified chat room as read with completion listener
TapCoreMessageManager.getInstance().markAllMessagesInRoomAsRead(ROOM_ID, object : TapCoreUpdateMessageStatusListener() {
override fun onSuccess(updatedMessageIDs: List<String>?) {
// updatedMessageIDs contains message IDs that were successfully marked as read
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) room ID of the messages to be marked as read
Get Local Messages from Chat Room
In a chat room, you can retrieve messages that are already stored in the device's local storage by calling getLocalMessages() method.
TapCoreMessageManager.getInstance().getLocalMessages(ROOM_ID, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Retrieved messages successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersROOM_ID: (String) the room ID to retrieve the messages for
Retrieving local messages is fast and reliable, but may not contain all messages available in the selected chat room. To obtain more messages that are available from the server, you may use getOlderMessagesBeforeTimestamp() and getNewerMessagesAfterTimestamp() methods.
Get Older Messages from Chat Room
To retrieve older messages in a chat room from the server, use the getOlderMessagesBeforeTimestamp() method.
TapCoreMessageManager.getInstance().getOlderMessagesBeforeTimestamp(ROOM_ID, MAX_CREATED_TIMESTAMP, NUMBER_OF_ITEMS, new TapCoreGetOlderMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages, Boolean hasMoreData) {
// hasMoreData will return true if more messages that have not been retrieved remain in the chat room
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getOlderMessagesBeforeTimestamp(ROOM_ID, MAX_CREATED_TIMESTAMP, NUMBER_OF_ITEMS, object : TapCoreGetOlderMessageListener() {
override fun onSuccess(messages: List<TAPMessageModel>, hasMoreData: Boolean?) {
// hasMoreData will return true if more messages that have not been retrieved remain in the chat room
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) the room ID to retrieve the messages for
MAX_CREATED_TIMESTAMP: (long) the maximum created time of the messages to retrieve, in milliseconds
NUMBER_OF_ITEMS: (int) maximum limit of the number of messages to retrieve
Get Newer Messages from Chat Room
To retrieve newer messages in a chat room from the server, use the getNewerMessagesAfterTimestamp() method.
TapCoreMessageManager.getInstance().getNewerMessagesAfterTimestamp(ROOM_ID, MIN_CREATED_TIMESTAMP, LAST_UPDATE_TIMESTAMP, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Retrieved messages successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
You can also call getNewerMessages() without providing MIN_CREATED_TIMESTAMP and LAST_UPDATE_TIMESTAMP, only providing ROOM_ID as the parameter. With this method, MIN_CREATED_TIMESTAMP will automatically be set to the oldest existing message's created time in the room, and LAST_UPDATE_TIMESTAMP will be obtained from local cache.
TapCoreMessageManager.getInstance().getNewerMessages(ROOM_ID, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Retrieved messages successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersROOM_ID: (String) the room ID to retrieve the messages for
MIN_CREATED_TIMESTAMP: (long) the minimum created time of the messages to retrieve, in millisecond
LAST_UPDATE_TIMESTAMP: (long) the minimum updated time of the messages to retrieve, in milliseconds
NUMBER_OF_ITEMS: (int) maximum limit of the number of messages to retrieve
Get All Messages from Chat Room
You may also retrieve all available messages from a chat room using the getAllMessagesFromRoom() method.
TapCoreMessageManager.getInstance().getAllMessagesFromRoom(ROOM_ID, new TapCoreGetAllMessageListener() {
@Override
public void onGetLocalMessagesCompleted(List<TAPMessageModel> messages) {
// Retrieved local messages from room
}
@Override
public void onGetAllMessagesCompleted(List<TAPMessageModel> allMessages, List<TAPMessageModel> olderMessages, List<TAPMessageModel> newerMessages) {
// Successfully retrieved all messages from room
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getAllMessagesFromRoom(ROOM_ID, object : TapCoreGetAllMessageListener() {
override fun onGetLocalMessagesCompleted(messages: List<TAPMessageModel>?) {
// Retrieved local messages from room
}
override fun onGetAllMessagesCompleted(allMessages: List<TAPMessageModel>?, olderMessages: List<TAPMessageModel>?, newerMessages: List<TAPMessageModel>?) {
// Successfully retrieved all messages from room
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) the room ID to retrieve the messages from
getAllMessagesFromRoom() is convenient to obtain all existing chat room messages since the beginning of the room creation, but the process will take longer depending on the number of messages contained in the selected room.
TapCoreGetAllMessageListener will trigger two callbacks sequentially during the process of retrieving messages:
• onGetLocalMessagesCompleted() will be triggered first once local messages are retrieved, the process will then continue to retrieve more messages from the server.
• onGetAllMessagesCompleted() will be triggered after all messages from the server are successfully retrieved, this callback contains three parameters containing all messages, older messages (that did not exist in local storage), and newer messages that have recently been updated), the latter two parameters might be empty depending on the situation.
Get Unread Messages from Chat Room
You can retrieve unread messages from the device's local storage by calling getUnreadMessagesFromRoom() method.
TapCoreMessageManager.getInstance().getUnreadMessagesFromRoom(ROOM_ID, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Retrieved messages successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersROOM_ID: (String) the room ID to retrieve the messages from
Get Media Messages from Chat Room
You can also retrieve media messages from the device's local storage, which consists of image, video, and documents, by calling getMediaMessagesFromRoom() method.
TapCoreMessageManager.getInstance().getUnreadMessagesFromRoom(ROOM_ID, LAST_TIMESTAMP, NUMBER_OF_ITEM, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Retrieved messages successfully
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersROOM_ID: (String) the room ID to retrieve the messages from
LAST_TIMESTAMP: (long) the maximum created time of the messages to retrieve, in milliseconds
NUMBER_OF_ITEM: (int) maximum limit of the number of messages to retrieve
Search Local Message
Call this method to search messages from the device's local storage with a keyword. Provided keyword will be used to filter message body in the search result.
TapCoreMessageManager.getInstance().searchLocalMessageWithKeyword(KEYWORD, new TapCoreGetMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages) {
// Returns filtered messages obtained from local storage
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().searchLocalMessageWithKeyword(KEYWORD, object : TapCoreGetMessageListener() {
override fun onSuccess(messages: List<TAPMessageModel>?) {
// Returns filtered messages obtained from local storage
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersKEYWORD: (String) search keyword to filter message body
Star/Unstar Messages
You may use these methods to mark a message or multiple messages as starred, or remove messages from the starred list. Only the active user can retrieve his/her own starred messages.
// Star single message
TapCoreMessageManager.getInstance().starMessage(ROOM_ID, MESSAGE_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of starred messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Star multiple messages
TapCoreMessageManager.getInstance().starMessages(ROOM_ID, MESSAGE_IDS, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of starred messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Unstar single message
TapCoreMessageManager.getInstance().unstarMessage(ROOM_ID, MESSAGE_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of unstarred messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Unstar multiple messages
TapCoreMessageManager.getInstance().unstarMessages(ROOM_ID, MESSAGE_IDS, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of unstarred messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Star single message
TapCoreMessageManager.getInstance().starMessage(ROOM_ID, MESSAGE_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of starred messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Star multiple messages
TapCoreMessageManager.getInstance().starMessages(ROOM_ID, MESSAGE_IDS, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of starred messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Unstar single message
TapCoreMessageManager.getInstance().unstarMessage(ROOM_ID, MESSAGE_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of unstarred messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Unstar multiple messages
TapCoreMessageManager.getInstance().unstarMessages(ROOM_ID, MESSAGE_IDS, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of unstarred messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
ParametersROOM_ID: (String) room ID, can be obtained from the message's room model
MESSAGE_ID: (String) unique server ID from the message
MESSAGE_IDS: (List<String>) list containing message IDs to be starred/unstarred
Get Starred Messages
You can use the method below get a list of message IDs marked as starred by the user.
TapCoreMessageManager.getInstance().getStarredMessageIds(ROOM_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of starred messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getStarredMessageIds(ROOM_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of starred messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
ParametersROOM_ID: (String) ID of the target room
A method to obtain the full message model list of the starred messages with pagination is also provided.
TapCoreMessageManager.getInstance().getStarredMessages(ROOM_ID, PAGE_NUMBER, NUMBER_OF_ITEMS, new TapCoreGetOlderMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages, Boolean hasMoreData) {
// hasMoreData will return true if the room has remaining starred messages that have not been retrieved
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getStarredMessages(ROOM_ID, PAGE_NUMBER, NUMBER_OF_ITEMS, object : TapCoreGetOlderMessageListener() {
override fun onSuccess(messages: List<TAPMessageModel>, hasMoreData: Boolean?) {
// hasMoreData will return true if the room has remaining starred messages that have not been retrieved
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) ID of the target room
PAGE_NUMBER: (int) the number of page to retrieve the items
NUMBER_OF_ITEMS: (int) number of items to be retrieved
Pin/Unpin Message
You may use these methods to pin or unpin a message or multiple messages in a chat room. Every participant in the room can retrieve the chat room's pinned messages.
// Pin single message
TapCoreMessageManager.getInstance().pinMessage(ROOM_ID, MESSAGE_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of pinned messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Pin multiple messages
TapCoreMessageManager.getInstance().pinMessage(ROOM_ID, MESSAGE_IDS, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of pinned messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Unpin single message
TapCoreMessageManager.getInstance().unpinMessage(ROOM_ID, MESSAGE_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of unpinned messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Unpin multiple messages
TapCoreMessageManager.getInstance().unpinMessage(ROOM_ID, MESSAGE_IDS, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of unpinned messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Pin single message
TapCoreMessageManager.getInstance().pinMessage(ROOM_ID, MESSAGE_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of pinned messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Pin multiple messages
TapCoreMessageManager.getInstance().pinMessage(ROOM_ID, MESSAGE_IDS, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of pinned messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Unpin single message
TapCoreMessageManager.getInstance().unpinMessage(ROOM_ID, MESSAGE_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of unpinned messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
// Unpin multiple messages
TapCoreMessageManager.getInstance().unpinMessage(ROOM_ID, MESSAGE_IDS, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of unpinned messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
ParametersROOM_ID: (String) room ID, can be obtained from the message's room model
MESSAGE_ID: (String) unique server ID from the message
MESSAGE_IDS: (List<String>) list containing message IDs to be pinned/unpinned
Get Pinned Messages
You can use the method below get a list of message IDs of pinned messages in a chat room.
TapCoreMessageManager.getInstance().getPinnedMessageIDs(ROOM_ID, new TapCoreGetStringArrayListener() {
@Override
public void onSuccess(ArrayList<String> arrayList) {
// Returns list of messageID of pinned messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getPinnedMessageIDs(ROOM_ID, object : TapCoreGetStringArrayListener() {
override fun onSuccess(arrayList: ArrayList<String>) {
// Returns list of messageID of pinned messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
});
ParametersROOM_ID: (String) ID of the target room
A method to obtain the full message model list of the pinned messages with pagination is also provided.
TapCoreMessageManager.getInstance().getPinnedMessages(ROOM_ID, PAGE_NUMBER, NUMBER_OF_ITEMS, new TapCoreGetOlderMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> messages, Boolean hasMoreData) {
// hasMoreData will return true if the room has remaining pinned messages that have not been retrieved
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getPinnedMessages(ROOM_ID, PAGE_NUMBER, NUMBER_OF_ITEMS, object : TapCoreGetOlderMessageListener() {
override fun onSuccess(messages: List<TAPMessageModel>, hasMoreData: Boolean?) {
// hasMoreData will return true if the room has remaining pinned messages that have not been retrieved
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) ID of the target room
PAGE_NUMBER: (int) the number of page to retrieve the items
NUMBER_OF_ITEMS: (int) number of items to be retrieved
Get Shared Content Messages
You can retrieve media-type messages, consisting of image, video, file, and link messages from a chat room by using getSharedContentMessages method.
TapCoreMessageManager.getInstance().getSharedContentMessages(ROOM, MIN_CREATED_TIMESTAMP, MAX_CREATED_TIMESTAMP, new TapCoreGetSharedContentMessageListener() {
@Override
public void onSuccess(List<TAPMessageModel> mediaMessages, List<TAPMessageModel> fileMessages, List<TAPMessageModel> linkMessages) {
// mediaMessages contains image and video messages
// fileMessages contains file/document messages
// linkMessages contains link messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreMessageManager.getInstance().getSharedContentMessages(ROOM, MIN_CREATED_TIMESTAMP, MAX_CREATED_TIMESTAMP, object : TapCoreGetSharedContentMessageListener() {
override fun onSuccess(mediaMessages: List<TAPMessageModel>, fileMessages: List<TAPMessageModel>, linkMessages: List<TAPMessageModel>) {
// mediaMessages contains image and video messages
// fileMessages contains file/document messages
// linkMessages contains link messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM: (TAPRoomModel) room to retrieve the messages from
MIN_CREATED_TIMESTAMP: (long) smallest created time of the messages to retrieve, use 0L to retrieve up to the oldest message in the room
MAX_CREATED_TIMESTAMP: (long) largest created time of the messages to retrieve, use current timestamp to retrieve up to the newest message in the room
Delete All Chat Room Messages
Use the deleteAllChatRoomMessages() method from the TapCoreChatRoomManager class to clear all existing messages in a selected chat room for the active user. The selected messages will only be deleted for the active user, and will not affect the other participants in the selected room.
TapCoreChatRoomManager.getInstance().deleteAllChatRoomMessages(ROOM_ID, new TapCommonListener() {
@Override
public void onSuccess(String successMessage) {
// Successfully deleted all messages in the chat room
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreChatRoomManager.getInstance().deleteAllChatRoomMessages(ROOM_ID, object : TapCommonListener() {
override fun onSuccess(successMessage: String?) {
// Successfully deleted all messages in the chat room
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersROOM_ID: (String) ID of the specified room to delete the messages from
Create Scheduled Message
You can schedule a constructed message model to be delivered at a specified time to a chat room.
TAPMessageModel constructedMessage = TapCoreMessageManager.getInstance().constructTapTalkMessageModel(
MESSAGE_BODY,
ROOM,
MESSAGE_TYPE,
MESSAGE_DATA);
TapCoreChatRoomManager.getInstance().createScheduledMessage(constructedMessage, TIMESTAMP, new TapCoreCreateScheduledMessageListener() {
@Override
public void onSuccess(TapScheduledMessageModel scheduledMessage) {
// Successfully created a scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
val constructedMessage = TapCoreMessageManager.getInstance().constructTapTalkMessageModel(
MESSAGE_BODY,
ROOM,
MESSAGE_TYPE,
MESSAGE_DATA
)
TapCoreChatRoomManager.getInstance().createScheduledMessage(constructedMessage, TIMESTAMP, object : TapCoreCreateScheduledMessageListener() {
override fun onSuccess(scheduledMessage: TapScheduledMessageModel) {
// Successfully created a scheduled message
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE_BODY: (String) content of the message
ROOM: (TAPRoomModel) the destination room where the message will be sent
MESSAGE_TYPE: (Integer) type of your custom message, check the Message Type page for more information
MESSAGE_DATA: (HashMap<String, Object>) custom data for the message (optional)
QUOTED_MESSAGE: (TAPMessageModel) quote of the new message model containing another existing message
TIMESTAMP: (long) time when the message will be delivered to the destination room (long value)
Get Scheduled Messages
You may then retrieve the list of created scheduled messages that have not yet been delivered in a chat room.
TapCoreChatRoomManager.getInstance().getScheduledMessages(ROOM_ID, new TapCoreGetScheduledMessagesListener() {
@Override
public void onSuccess(List<TapScheduledMessageModel> scheduledMessages) {
// Successfully retrieved scheduled messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersROOM_ID: (String) ID of the destination chat room
Send Scheduled Message Now
You may also send a previously created scheduled message immediately to the recipient.
// Send a scheduled message immediately
TapCoreChatRoomManager.getInstance().sendScheduledMessageNow(SCHEDULED_MESSAGE_ID, ROOM_ID, new TapCoreGetIntegerArrayListener() {
@Override
public void onSuccess(ArrayList<Integer> sentIDs) {
// Successfully sent scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Send multiple scheduled messages immediately
TapCoreChatRoomManager.getInstance().sendScheduledMessagesNow(SCHEDULED_MESSAGE_IDS, ROOM_ID, new TapCoreGetIntegerArrayListener() {
@Override
public void onSuccess(ArrayList<Integer> sentIDs) {
// Successfully sent scheduled messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Send a scheduled message immediately
TapCoreChatRoomManager.getInstance().sendScheduledMessageNow(SCHEDULED_MESSAGE_ID, ROOM_ID, object : TapCoreGetIntegerArrayListener() {
override fun onSuccess(sentIDs: ArrayList<Int>) {
// Successfully sent scheduled message
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
// Send multiple scheduled messages immediately
TapCoreChatRoomManager.getInstance().sendScheduledMessagesNow(SCHEDULED_MESSAGE_IDS, ROOM_ID, object : TapCoreGetIntegerArrayListener() {
override fun onSuccess(sentIDs: ArrayList<Int>) {
// Successfully sent scheduled messages
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersSCHEDULED_MESSAGE_ID: (Integer) ID of the previously created scheduled message
SCHEDULED_MESSAGE_IDS: (List<Integer>) list of scheduled message IDs
ROOM_ID: (String) ID of the destination chat room
Edit Scheduled Message Time
To change the deliver time of a previously created scheduled message, use the editScheduledMessageTime method from TAPCoreMessageManager.
TapCoreChatRoomManager.getInstance().editScheduledMessageTime(SCHEDULED_MESSAGE_ID, TIMESTAMP, new TapCommonListener() {
@Override
public void onSuccess(String successMessage) {
// Successfully edited scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersSCHEDULED_MESSAGE_ID: (Integer) ID of the previously created scheduled message
TIMESTAMP: (long) time when the message will be delivered to the destination room (long value)
Edit Scheduled Message Content
You may also update the contents of a scheduled message that was previously created before it is delivered to the recipient.
// Edit message with updated message model
TapCoreChatRoomManager.getInstance().editScheduledMessageContent(SCHEDULED_MESSAGE_ID, UPDATED_MESSAGE, new TapCommonListener() {
@Override
public void onSuccess(String successMessage) {
// Successfully edited scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Edit text content of the existing message
TapCoreChatRoomManager.getInstance().editScheduledMessageContent(SCHEDULED_MESSAGE_ID, PREVIOUS_MESSAGE, UPDATED_TEXT, new TapCommonListener() {
@Override
public void onSuccess(String successMessage) {
// Successfully edited scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Edit message with updated message model
TapCoreChatRoomManager.getInstance().editScheduledMessageContent(SCHEDULED_MESSAGE_ID, UPDATED_MESSAGE, object : TapCommonListener() {
override fun onSuccess(successMessage: String) {
// Successfully edited scheduled message
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
// Edit text content of the existing message
TapCoreChatRoomManager.getInstance().editScheduledMessageContent(SCHEDULED_MESSAGE_ID, PREVIOUS_MESSAGE, UPDATED_TEXT, object : TapCommonListener() {
override fun onSuccess(successMessage: String) {
// Successfully edited scheduled message
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersSCHEDULED_MESSAGE_ID: (Integer) ID of the previously created scheduled message
UPDATED_MESSAGE: (TAPMessageModel) message model with updated values
PREVIOUS_MESSAGE: (TAPMessageModel) existing message model to be edited
UPDATED_TEXT: (String) text content to update the message model
Delete Scheduled Message
To cancel sending a scheduled message that has not been delivered, you can delete it using deleteScheduledMessage method.
// Delete a scheduled message
TapCoreChatRoomManager.getInstance().deleteScheduledMessage(SCHEDULED_MESSAGE_ID, ROOM_ID, new TapCoreGetIntegerArrayListener() {
@Override
public void onSuccess(ArrayList<Integer> deletedIDs) {
// Successfully deleted scheduled message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
// Delete multiple scheduled messages
TapCoreChatRoomManager.getInstance().deleteScheduledMessages(SCHEDULED_MESSAGE_IDS, ROOM_ID, new TapCoreGetIntegerArrayListener() {
@Override
public void onSuccess(ArrayList<Integer> deletedIDs) {
// Successfully deleted scheduled messages
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
ParametersSCHEDULED_MESSAGE_ID: (Integer) ID of the previously created scheduled message
SCHEDULED_MESSAGE_IDS: (List<Integer>) list of scheduled message IDs
ROOM_ID: (String) ID of the destination chat room
Get Message Details
You can retrieve info about a message's recipients that has read or received the message.
TapCoreChatRoomManager.getInstance().getMessageDetails(MESSAGE_ID, new TapCoreGetMessageDetailsListener() {
@Override
public void onSuccess(TAPMessageModel message, List<TapMessageRecipientModel> deliveredTo, List<TapMessageRecipientModel> readBy) {
// Successfully retrieved message info
// message: the message model
// deliveredTo: list of recipients that has received the message
// readBy: list of recipients that has read the message
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});
TapCoreChatRoomManager.getInstance().getMessageDetails(MESSAGE_ID, object : TapCoreGetMessageDetailsListener() {
override fun onSuccess(message: TAPMessageModel, deliveredTo: List<TapMessageRecipientModel>?, readBy: List<TapMessageRecipientModel>?) {
// Successfully retrieved message info
// message: the message model
// deliveredTo: list of recipients that has received the message
// readBy: list of recipients that has read the message
}
override fun onError(errorCode: String?, errorMessage: String?) {
}
})
ParametersMESSAGE_ID: (String) unique server ID from the message
Get Message Total Read Count
You can also retrieve a message's total read count from a non-personal room.
TapCoreChatRoomManager.getInstance().getMessageTotalRead(MESSAGE_ID, new TapCoreGetIntegerListener() {
@Override
public void onSuccess(int readCount) {
// Successfully retrieved message read count
}
@Override
public void onError(String errorCode, String errorMessage) {
}
});