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