General

Get TapTalk Implementation Type

You can check the TapTalk.io implementation type used in your application by calling getTapTalkImplementationType().
Java
Kotlin
1
TapTalkImplementationType implementationType = TapTalk.getTapTalkImplementationType();
Copied!
1
var implementationType = TapTalk.getTapTalkImplementationType()
Copied!
IMPLEMENTATION_TYPE
TapTalk implementation consists of 3 types which are:
  • TapTalkImplementationTypeUI: used for implementation with only TapUI
  • TapTalkImplementationTypeCore: used for implementation with only TapCore
  • TapTalkImplementationTypeCombine: used for implementation with both of TapCore and TapUI combined

Update Application Badge Count

Calling updateApplicationBadgeCount() will refresh the number of unread messages in the application and trigger the callback onTapTalkUnreadChatRoomBadgeCountUpdated() present in TapListener.
Java
Kotlin
1
TapTalk.updateApplicationBadgeCount();
Copied!
1
TapTalk.updateApplicationBadgeCount()
Copied!

Remote Configs

A TapTalk.io project owns a remote configuration, which consists of 3 configuration types: Core Configs, Project Configs, and Custom Configs. A configuration value can be obtained with the respective configuration type's getter method, and will return a Map object. To get a specific value, call the get() method from the returned Map with the respective key. The value obtained will always be in a String format and should be converted each according to their uses. Each configuration type will be explained below.

Core Configs

Config Key
Value
chatMediaMaxFileSize
Number of maximum allowed chat media file size in bytes
roomPhotoMaxFileSize
Number of maximum allowed group chat room profile picture file size in bytes
userPhotoMaxFileSize
Number of maximum allowed user profile picture file size in bytes
groupMaxParticipants
Number of maximum allowed participants in a group chat room
channelMaxParticipants
Number of maximum allowed participants in a channel
Below is an example to get the value of chatMediaMaxFileSize:
Java
Kotlin
1
Map<String, String> coreConfigs = TapTalk.getCoreConfigs();
2
String maxFileSizeString = coreConfigs.get("chatMediaMaxFileSize");
3
long maxFileSizeValue = Long.valueOf(maxFileSize);
Copied!
1
val coreConfigs = TapTalk.getCoreConfigs()
2
val maxFileSizeString = coreConfigs["chatMediaMaxFileSize"]
3
val maxFileSizeValue = maxFileSize?.toLong()
Copied!

Project Configs

Config Key
Value
usernameIgnoreCase
"0" if username in the project is case sensitive "1" if username in the project is case insensitive
An example to obtain usernameIgnoreCase value:
Java
Kotlin
1
Map<String, String> projectConfigs = TapTalk.getProjectConfigs();
2
String usernameIgnoreCase = projectConfigs.get("usernameIgnoreCase");
3
boolean isUsernameIgnoreCase;
4
if (usernameIgnoreCase.equals("0")) {
5
isUsernameIgnoreCase = false;
6
} else if (usernameIgnoreCase.equals("1")) {
7
isUsernameIgnoreCase = true;
8
}
Copied!
1
val projectConfigs = TapTalk.getProjectConfigs()
2
val usernameIgnoreCase = projectConfigs["usernameIgnoreCase"]
3
val isUsernameIgnoreCase: Boolean
4
if (usernameIgnoreCase == "0") {
5
isUsernameIgnoreCase = false
6
} else if (usernameIgnoreCase == "1") {
7
isUsernameIgnoreCase = true
8
}
Copied!

Custom Configs

Custom config values are specified by the user, and can be customized through the TapTalk.io Dashboard. To get the project's custom configs, call the getCustomConfigs() method.JavaKotlin
Java
Kotlin
1
Map<String, String> customConfigs = TapTalk.getCustomConfigs();
Copied!
1
val customConfigs = TapTalk.getCustomConfigs()
Copied!

Refresh Remote Configs

To refresh remote configs with the latest updated values, call the refreshRemoteConfigs() method in TapTalk.io class.
Java
Kotlin
1
TapTalk.refreshRemoteConfigs(new TapCommonListener() {
2
@Override
3
public void onSuccess(String successMessage) {
4
// Updated configs successfully
5
}
6
7
@Override
8
public void onError(String errorCode, String errorMessage) {
9
10
}
11
});
Copied!
1
TapTalk.refreshRemoteConfigs(object : TapCommonListener() {
2
override fun onSuccess(successMessage: String?) {
3
// Updated configs successfully
4
}
5
6
override fun onError(errorCode: String?, errorMessage: String?) {
7
8
}
9
})
Copied!

Enable / Disable Auto Contact Sync

If you are using UI implementation method in your application, TapTalk.io provides a feature to automatically sync your user's phone contacts with their TapTalk.io contacts. You can choose to enable or disable auto contact sync by calling these methods. If auto contact sync is enabled, TapTalk.io will automatically sync your user's phone contacts and add them to TapTalk.io contacts if their phone number is registered to TapTalk.io when the application is opened. Please note that the default value is enabled.JavaKotlin
Java
Kotlin
1
@Override
2
public void onCreate() {
3
...
4
5
// Call this method to enable or disable auto contact sync
6
// The default value is set to enabled if you do not set this method
7
TapTalk.setAutoContactSyncEnabled(IS_ENABLED);
8
}
Copied!
1
override fun onCreate(savedInstanceState: Bundle?) {
2
...
3
4
// Call this method to enable or disable auto contact sync
5
// The default value is set to enabled if you do not set this method
6
TapTalk.setAutoContactSyncEnabled(IS_ENABLED)
7
}
Copied!
Parameters IS_ENABLED: (boolean) set to true to enable auto contact sync

Get Auto Contact Sync Status

Use this method to obtain auto contact sync status. This method will return true if auto contact sync is enabled.
Java
Kotlin
1
boolean isAutoContactSyncEnabled = TapTalk.isAutoContactSyncEnabled();
Copied!
1
val isAutoContactSyncEnabled = TapTalk.isAutoContactSyncEnabled()
Copied!

Smart Local Cache Management

In order to optimize storage usage and performance, TapTalk.io cleans any local data of messages that are older than 1 month. This cleanup runs on a scheduled interval. Deleted messages can later be retrieved from the server when required.

Get Current Activity / Fragment in TapUI

You can obtain the currently showing room list fragment, chat activity, or any TapTalk activity from TapUI using the following methods:
Java
Kotlin
1
// Obtain TapUIRoomListFragment
2
TapUI.getInstance().getCurrentTapTalkRoomListFragment();
3
4
// Obtain currently showing TapUIChatActivity
5
TapUI.getInstance().getCurrentTapTalkChatActivity();
6
7
// Obtain any AppCompatActivity in the foreground
8
TapUI.getInstance().getCurrentForegroundTapTalkActivity();
Copied!
1
// Obtain TapUIRoomListFragment
2
TapUI.getInstance().getCurrentTapTalkRoomListFragment()
3
4
// Obtain currently showing TapUIChatActivity
5
TapUI.getInstance().getCurrentTapTalkChatActivity()
6
7
// Obtain any AppCompatActivity in the foreground
8
TapUI.getInstance().getCurrentForegroundTapTalkActivity()
Copied!
Note: the methods above may return null if the selected activity or fragment is not found.

Set Image Compression Quality

You can customize the compression quality of images used for upload and download. The range of the compression quality is set between 10 and 100. The higher the quality, the better the images will look, but they will also take more storage space as their size increases.
Java
Kotlin
1
TapTalk.setImageCompressionQuality(IMAGE_COMPRESSION_QUALITY);
Copied!
1
TapTalk.setImageCompressionQuality(IMAGE_COMPRESSION_QUALITY)
Copied!
Parameters IMAGE_COMPRESSION_QUALITY: (int) image compression quality between 10 to 100