public final class SendBird
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static interface |
SendBird.AddFriendsHandler
AddFriendsHandler handler.
|
static class |
SendBird.ChannelHandler
Channel handler.
|
static interface |
SendBird.ConnectHandler
Connect handler.
|
static interface |
SendBird.ConnectionHandler
Connection handler.
|
static class |
SendBird.ConnectionState
SDK connection state.
|
static interface |
SendBird.DeleteFriendDiscoveriesHandler
DeleteFriendDiscoveriesHandler handler.
|
static interface |
SendBird.DeleteFriendDiscoveryHandler
DeleteFriendDiscoveryHandler handler.
|
static interface |
SendBird.DeleteFriendHandler
DeleteFriendHandler handler.
|
static interface |
SendBird.DeleteFriendsHandler
DeleteFriendsHandler handler.
|
static interface |
SendBird.DisconnectHandler
Disconnect handler.
|
static interface |
SendBird.GetAllEmojiHandler
getAllEmoji handler.
|
static interface |
SendBird.GetChannelInvitationPreferenceHandler
GetAutoAcceptInvitation handler.
|
static interface |
SendBird.GetDoNotDisturbHandler
GetDoNotDisturb handler.
|
static interface |
SendBird.GetEmojiCategoryHandler
getEmojiCategory handler.
|
static interface |
SendBird.GetEmojiHandler
getEmoji handler.
|
static interface |
SendBird.GetFriendChangeLogsByTokenHandler
GetFriendChangeLogsByTokenHandler handler.
|
static interface |
SendBird.GetMyGroupChannelChangeLogsHandler
GetMyGroupChannelChangeLogsHandler handler.
|
static interface |
SendBird.GetPushSoundHandler
GetPushSound handler.
|
static interface |
SendBird.GetPushTemplateHandler
GetPushTemplate handler.
|
static interface |
SendBird.GetPushTokensHandler
GetPushTokens handler.
|
static interface |
SendBird.GetPushTriggerOptionHandler
GetPushTriggerOptionHandler handler.
|
static interface |
SendBird.GetSnoozePeriodHandler
GetSnoozePeriodHandler handler.
|
static class |
SendBird.HMS
Push token related class specifically for Huawei Message Service, HMS.
|
static interface |
SendBird.MarkAsReadHandler
GroupChannelMarkAsRead handler.
|
static class |
SendBird.Options
Represents operation options.
|
static class |
SendBird.PushTokenRegistrationStatus
Status of push token registration.
|
static class |
SendBird.PushTokenType
PushTokenType.
|
static class |
SendBird.PushTriggerOption
PushTriggerOption of the current
User . |
static interface |
SendBird.RegisterPushTokenHandler
Deprecated.
As of 3.0.2, replaced by
SendBird.RegisterPushTokenWithStatusHandler . |
static interface |
SendBird.RegisterPushTokenWithStatusHandler
RegisterPushTokenWithStatus handler.
|
static interface |
SendBird.SetChannelInvitationPreferenceHandler
SetAutoAcceptInvitation handler.
|
static interface |
SendBird.SetDoNotDisturbHandler
SetDoNotDisturb handler.
|
static interface |
SendBird.SetPushSoundHandler
SetPushSound handler.
|
static interface |
SendBird.SetPushTemplateHandler
SetPushTemplate handler.
|
static interface |
SendBird.SetPushTriggerOptionHandler
SetPushTriggerOptionHandler handler.
|
static interface |
SendBird.SetSnoozePeriodHandler
SetSnoozePeriodHandler handler.
|
static interface |
SendBird.UnregisterPushTokenHandler
UnregisterPushToken handler.
|
static interface |
SendBird.UploadFriendDiscoveriesHandler
UploadFriendDiscoveriesHandler handler.
|
static interface |
SendBird.UserBlockHandler
UserBlock handler.
|
static class |
SendBird.UserEventHandler
User event handler.
|
static interface |
SendBird.UserInfoUpdateHandler
UserInfoUpdate handler.
|
static interface |
SendBird.UserUnblockHandler
UserUnblock handler.
|
Modifier and Type | Field and Description |
---|---|
static int |
LOGGER_INFO |
static int |
LOGGER_NONE |
static java.lang.String |
PUSH_TEMPLATE_ALTERNATIVE
|
static java.lang.String |
PUSH_TEMPLATE_DEFAULT
|
Modifier and Type | Method and Description |
---|---|
static void |
addChannelHandler(java.lang.String identifier,
SendBird.ChannelHandler handler)
Adds a channel handler.
|
static void |
addConnectionHandler(java.lang.String identifier,
SendBird.ConnectionHandler handler)
Adds a connection handler.
|
static void |
addExtension(java.lang.String key,
java.lang.String version)
To send additional User-Agent information please set the version information.
|
static void |
addFriends(java.util.List<java.lang.String> userIds,
SendBird.AddFriendsHandler handler)
Add friends.
|
static void |
addUserEventHandler(java.lang.String identifier,
SendBird.UserEventHandler handler)
Adds a user event handler.
|
static void |
allowFriendDiscovery(boolean allow,
AllowFriendDiscoveryHandler handler)
Sets friend discoverability of current user.
|
static void |
blockUser(User userToBlock,
SendBird.UserBlockHandler handler)
Blocks the specified
User . |
static void |
blockUserWithUserId(java.lang.String userIdToBlock,
SendBird.UserBlockHandler handler)
Blocks the specified
User ID. |
static void |
clearCachedData(android.content.Context context,
CompletionHandler handler)
Clears the db data used in local caching.
|
static void |
clearCachedMessages(java.lang.String channelUrl,
CompletionHandler handler)
Clear cached messages of specific channel.
|
static void |
connect(java.lang.String userId,
SendBird.ConnectHandler handler)
Connects to SendBird with given
User ID. |
static void |
connect(java.lang.String userId,
java.lang.String accessToken,
SendBird.ConnectHandler handler)
Connects to SendBird with given
User ID and access token. |
static void |
connect(java.lang.String userId,
java.lang.String accessToken,
java.lang.String apiHost,
java.lang.String wsHost,
SendBird.ConnectHandler handler)
Connects to SendBird with given
User ID and access token. |
static ApplicationUserListQuery |
createApplicationUserListQuery()
Creates a query instance to get the whole
User list. |
static BlockedUserListQuery |
createBlockedUserListQuery()
Creates a query instance to get only the blocked
User (by me) list. |
static FriendListQuery |
createFriendListQuery()
Creates a query instance to get friends.
|
static UserListQuery |
createUserListQuery()
Deprecated.
As of 3.0.81, replaced by
createApplicationUserListQuery() . |
static UserListQuery |
createUserListQuery(java.util.List<java.lang.String> userIds)
Deprecated.
As of 3.0.81, replaced by
createApplicationUserListQuery() with ApplicationUserListQuery.setUserIdsFilter(List) . |
static void |
deleteFriend(java.lang.String userId,
SendBird.DeleteFriendHandler handler)
Delete friend.
|
static void |
deleteFriendDiscoveries(java.util.List<java.lang.String> discoveryKeys,
SendBird.DeleteFriendDiscoveriesHandler handler)
Delete friend discoveries.
|
static void |
deleteFriendDiscovery(java.lang.String discoveryKey,
SendBird.DeleteFriendDiscoveryHandler handler)
Delete friend discovery.
|
static void |
deleteFriends(java.util.List<java.lang.String> userIds,
SendBird.DeleteFriendsHandler handler)
Delete friends.
|
static void |
disconnect(SendBird.DisconnectHandler handler)
Disconnects from SendBird.
|
static void |
disconnectWebSocket(SendBird.DisconnectHandler handler)
Disconnects the websocket connection only.
|
static void |
getAllEmoji(SendBird.GetAllEmojiHandler handler)
Requests the all emoji.
|
static void |
getAllowFriendDiscovery(GetAllowFriendDiscoveryHandler handler)
Gets friend discoverability of current user.
|
static AppInfo |
getAppInfo()
Returns obtain information on the set application settings.
|
static java.lang.String |
getApplicationId()
Returns current application ID.
|
static boolean |
getAutoBackgroundDetection()
Gets SendBird auto background detection status.
|
static java.lang.Long |
getCachedDataSize(android.content.Context context)
Gets the size of cached data.
|
static void |
getChannelInvitationPreference(SendBird.GetChannelInvitationPreferenceHandler handler)
Gets the current
User 's preference for GroupChannel join. |
static SendBird.ConnectionState |
getConnectionState()
Gets SDK connection state.
|
static User |
getCurrentUser()
Gets the current
User . |
static void |
getDoNotDisturb(SendBird.GetDoNotDisturbHandler handler)
Gets Do-not-disturb option for the current
User . |
static java.lang.String |
getEkey()
Gets the key to authenticate the url retrieved from
FileMessage.getPlainUrl() ,
User.getPlainProfileImageUrl() and FileMessage.Thumbnail.getPlainUrl() . |
static void |
getEmoji(java.lang.String key,
SendBird.GetEmojiHandler handler)
Requests the emoji.
|
static void |
getEmojiCategory(long emojiCategoryId,
SendBird.GetEmojiCategoryHandler handler)
Requests the emoji category.
|
static void |
getFriendChangeLogsByToken(java.lang.String token,
SendBird.GetFriendChangeLogsByTokenHandler handler)
Get friend changelogs by token.
|
static void |
getGroupChannelCount(GroupChannelListQuery.MemberStateFilter memberStateFilter,
GroupChannel.GroupChannelChannelCountHandler handler)
Gets the number of my
GroupChannel s. |
static long |
getLastConnectedAt()
Gets the last connected timestamp.
|
static void |
getMyGroupChannelChangeLogsByTimestamp(long ts,
java.util.List<java.lang.String> customTypes,
boolean includeEmpty,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Deprecated.
|
static void |
getMyGroupChannelChangeLogsByTimestamp(long ts,
java.util.List<java.lang.String> customTypes,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Deprecated.
|
static void |
getMyGroupChannelChangeLogsByTimestampWithParams(long ts,
GroupChannelChangeLogsParams params,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Requests the channel changelogs after given timestamp.
|
static void |
getMyGroupChannelChangeLogsByToken(java.lang.String token,
java.util.List<java.lang.String> customTypes,
boolean includeEmpty,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Deprecated.
|
static void |
getMyGroupChannelChangeLogsByToken(java.lang.String token,
java.util.List<java.lang.String> customTypes,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Deprecated.
|
static void |
getMyGroupChannelChangeLogsByTokenWithParams(java.lang.String token,
GroupChannelChangeLogsParams params,
SendBird.GetMyGroupChannelChangeLogsHandler handler)
Requests the channel changelogs from given token.
|
static void |
getMyPushTokensByToken(java.lang.String token,
SendBird.PushTokenType type,
SendBird.GetPushTokensHandler handler)
Requests push tokens of current user from given token.
|
static boolean |
getNetworkAwarenessReconnection()
Gets SendBird network awareness reconnection status.
|
static java.lang.String |
getOSVersion()
Returns current OS version.
|
static java.lang.String |
getPendingPushToken()
Gets the pending push token.
|
static void |
getPushSound(SendBird.GetPushSoundHandler handler)
Gets push notification sound path for the current
User . |
static void |
getPushTemplate(SendBird.GetPushTemplateHandler handler)
Gets push template option for the current
User . |
static void |
getPushTriggerOption(SendBird.GetPushTriggerOptionHandler handler)
Gets the current
User 's push trigger option. |
static java.lang.String |
getSDKVersion()
Returns current SDK version.
|
static void |
getSnoozePeriod(SendBird.GetSnoozePeriodHandler handler)
Gets snooze period for the current
User . |
static int |
getSubscribedCustomTypeTotalUnreadMessageCount()
Gets the total number of unread message of
GroupChannel s with subscribed custom types. |
static int |
getSubscribedCustomTypeUnreadMessageCount(java.lang.String customType)
Gets the number of unread message of
GroupChannel with subscribed custom type. |
static int |
getSubscribedTotalUnreadMessageCount()
Gets the subscribed total number of unread message of all
GroupChannel s the current user has joined. |
static void |
getTotalUnreadChannelCount(GroupChannel.GroupChannelTotalUnreadChannelCountHandler handler)
Gets the total number of unread
GroupChannel s the current user has joined. |
static void |
getTotalUnreadChannelCount(GroupChannelTotalUnreadChannelCountParams params,
GroupChannel.GroupChannelTotalUnreadChannelCountHandler handler)
Gets the total number of unread
GroupChannel s the current user has joined. |
static void |
getTotalUnreadMessageCount(GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
Gets the total number of unread message of all
GroupChannel s the current user has joined. |
static void |
getTotalUnreadMessageCount(GroupChannelTotalUnreadMessageCountParams params,
GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
Gets the total number of unread message of
GroupChannel s with GroupChannelTotalUnreadMessageCountParams filter. |
static void |
getTotalUnreadMessageCount(java.util.List<java.lang.String> channelCustomTypes,
GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
Gets the total number of unread message of
GroupChannel s with channel custom types filter. |
static void |
getUnreadItemCount(java.util.Collection<GroupChannel.UnreadItemKey> keys,
GroupChannel.GroupChannelGetUnreadItemCountHandler handler)
Gets the unread item count of
GroupChannel s from keys. |
static boolean |
init(java.lang.String appId,
android.content.Context context)
Deprecated.
As of 3.1.0, replaced by
init(String, Context, boolean, InitResultHandler) . |
static void |
init(java.lang.String appId,
android.content.Context context,
boolean useCaching,
InitResultHandler handler)
Initializes SendBird with given app ID.
|
static boolean |
initFromForeground(java.lang.String appId,
android.content.Context context)
Deprecated.
As of 3.1.0, replaced by
initFromForeground(String, Context, boolean, InitResultHandler) . |
static void |
initFromForeground(java.lang.String appId,
android.content.Context context,
boolean useCaching,
InitResultHandler handler)
Initializes SendBird with given app ID.
|
static boolean |
isUsingLocalCaching()
Returns whether the app uses local caching.
|
static void |
markAsDelivered(java.util.Map<java.lang.String,java.lang.String> data)
Sends mark as delivered to this channel when you received push message from us.
|
static void |
markAsDelivered(java.lang.String channelUrl)
Deprecated.
As of 3.0.150, replaced by
markAsDelivered(Map) . |
static void |
markAsReadAll(SendBird.MarkAsReadHandler handler)
Sends mark as read to all joined
GroupChannel s. |
static void |
markAsReadWithChannelUrls(java.util.List<java.lang.String> channelUrls,
SendBird.MarkAsReadHandler handler)
Sends mark as read to joined
GroupChannel s. |
static void |
notifyActivityPausedForOldAndroids()
Deprecated.
As of 3.0.136, if you set
setAutoBackgroundDetection(boolean) to
true , you do not need to call this function manually. |
static void |
notifyActivityResumedForOldAndroids()
Deprecated.
As of 3.0.136, if you set
setAutoBackgroundDetection(boolean) to
true , you do not need to call this function manually. |
static boolean |
reconnect()
Tries reconnection with previously and successfully connected user information.
|
static void |
registerPushTokenForCurrentUser(java.lang.String gcmRegToken,
boolean unique,
SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current
User to receive push notification. |
static void |
registerPushTokenForCurrentUser(java.lang.String gcmRegToken,
SendBird.RegisterPushTokenHandler handler)
Deprecated.
As of 3.0.2, replaced by
registerPushTokenForCurrentUser(String, RegisterPushTokenWithStatusHandler) . |
static void |
registerPushTokenForCurrentUser(java.lang.String gcmRegToken,
SendBird.RegisterPushTokenWithStatusHandler handler)
Registers push token for the current
User to receive push notification. |
static void |
removeAllChannelHandlers()
Removes all channel handlers added by
addChannelHandler(String, ChannelHandler) . |
static void |
removeAllConnectionHandlers()
Removes all connection handlers added by
addConnectionHandler(String, ConnectionHandler) . |
static void |
removeAllUserEventHandlers()
Removes all user event handlers added by
addUserEventHandler(String, UserEventHandler) . |
static SendBird.ChannelHandler |
removeChannelHandler(java.lang.String identifier)
Removes a channel handler.
|
static SendBird.ConnectionHandler |
removeConnectionHandler(java.lang.String identifier)
Removes a connection handler.
|
static SendBird.UserEventHandler |
removeUserEventHandler(java.lang.String identifier)
Removes a user event handler.
|
static void |
runOnUIThread(java.lang.Runnable runnable) |
static void |
setAppVersion(java.lang.String version)
Sets the app version.
|
static void |
setAutoBackgroundDetection(boolean enable)
Sets SendBird to detect if the
Application is in background automatically. |
static void |
setChannelInvitationPreference(boolean autoAccept,
SendBird.SetChannelInvitationPreferenceHandler handler)
Sets the current
User 's preference for GroupChannel join. |
static void |
setDoNotDisturb(boolean doNotDisturbOn,
int startHour,
int startMin,
int endHour,
int endMin,
java.lang.String timezone,
SendBird.SetDoNotDisturbHandler handler)
Sets Do-not-disturb option for the current
User . |
static void |
setLoggerLevel(int level)
Sets logger level.
|
static void |
setLoggerLevel(LogLevel logLevel)
As of 3.0.153, Sets the logger level for server request/response related logs.
|
static void |
setNetworkAwarenessReconnection(boolean enable)
Sets SendBird to reconnect automatically by network awareness.
|
static void |
setPushSound(java.lang.String sound,
SendBird.SetPushSoundHandler handler)
Sets the push notification sound file path for the current
User . |
static void |
setPushTemplate(java.lang.String templateName,
SendBird.SetPushTemplateHandler handler)
Sets push template option for the current
User . |
static void |
setPushTriggerOption(SendBird.PushTriggerOption pushTriggerOption,
SendBird.SetPushTriggerOptionHandler handler)
Sets the current
User 's push trigger option. |
static void |
setSessionHandler(SessionHandler sessionHandler)
Set a
SessionHandler which is required for SDK refresh the session when the current session expires. |
static void |
setSnoozePeriod(boolean snoozeOn,
long startTs,
long endTs,
SendBird.SetSnoozePeriodHandler handler)
Sets snooze period for the current
User . |
static void |
unblockUser(User blockedUser,
SendBird.UserUnblockHandler handler)
Unblocks the specified
User . |
static void |
unblockUserWithUserId(java.lang.String blockedUserId,
SendBird.UserUnblockHandler handler)
Unblocks the specified
User ID. |
static void |
unregisterPushTokenAllForCurrentUser(SendBird.UnregisterPushTokenHandler handler)
Unregisters all push token bound to the current
User . |
static void |
unregisterPushTokenForCurrentUser(java.lang.String gcmRegToken,
SendBird.UnregisterPushTokenHandler handler)
Unregisters push token for the current
User . |
static void |
updateCurrentUserInfo(java.util.List<java.lang.String> preferredLanguages,
SendBird.UserInfoUpdateHandler handler)
Updates current
User 's information. |
static void |
updateCurrentUserInfo(java.lang.String nickname,
java.lang.String profileUrl,
SendBird.UserInfoUpdateHandler handler)
Updates current
User 's information. |
static void |
updateCurrentUserInfoWithProfileImage(java.lang.String nickname,
java.io.File profileImage,
SendBird.UserInfoUpdateHandler handler)
Updates current
User 's information. |
static void |
uploadFriendDiscoveries(java.util.Map<java.lang.String,java.lang.String> discoveryMap,
SendBird.UploadFriendDiscoveriesHandler handler)
Upload friend discoveries.
|
public static final int LOGGER_NONE
public static final int LOGGER_INFO
public static final java.lang.String PUSH_TEMPLATE_DEFAULT
setPushTemplate(String, SetPushTemplateHandler)
, setPushTemplate(String, SetPushTemplateHandler)
.public static final java.lang.String PUSH_TEMPLATE_ALTERNATIVE
setPushTemplate(String, SetPushTemplateHandler)
, setPushTemplate(String, SetPushTemplateHandler)
.public static void addExtension(java.lang.String key, java.lang.String version)
key
- KEY of value you want to send.version
- a value you want to send.public static void runOnUIThread(java.lang.Runnable runnable)
public static java.lang.String getOSVersion()
public static java.lang.String getSDKVersion()
public static java.lang.String getApplicationId()
public static void setLoggerLevel(int level)
level
- Level of logger. LOGGER_NONE
or LOGGER_INFO
can be assigned.public static void setLoggerLevel(LogLevel logLevel)
logLevel
- desired log level. When set to LogLevel.VERBOSE
, all logs will be
printed. When set to LogLevel.ERROR
, only error logs will be
printed.LogLevel
public static void setAppVersion(java.lang.String version)
init(String, Context, boolean, InitResultHandler)
.version
- The version of the app.public static void init(java.lang.String appId, android.content.Context context, boolean useCaching, InitResultHandler handler)
appId
- Application ID which you can get by creating the application at SendBird Dashboard.context
- Context
of Application
.useCaching
- Determine whether to use database in the SDK.handler
- Handler to receive SendBird.init function call processing results.
Application ID can be changed by calling this with different application IDs.
Notice that only on CLOSED connection status application ID can be modified.public static void clearCachedData(android.content.Context context, CompletionHandler handler)
init(String, Context, boolean, InitResultHandler)
or
initFromForeground(String, Context, boolean, InitResultHandler)
.context
- Context
.init(String, Context, boolean, InitResultHandler).
,
initFromForeground(String, Context, boolean, InitResultHandler).
public static void clearCachedMessages(java.lang.String channelUrl, CompletionHandler handler)
channelUrl
- target channel's urlclearCachedData(Context, CompletionHandler)
public static java.lang.Long getCachedDataSize(android.content.Context context)
clearCachedData(Context, CompletionHandler)
If you want to clear specific channel's cache, call clearCachedMessages(String, CompletionHandler)
context
- Context
.clearCachedData(Context, CompletionHandler)
,
clearCachedMessages(String, CompletionHandler)
@Deprecated public static boolean init(java.lang.String appId, android.content.Context context)
init(String, Context, boolean, InitResultHandler)
.appId
- Application ID which you can get by creating the application at SendBird Dashboard.context
- Context
of Application
.@Deprecated public static boolean initFromForeground(java.lang.String appId, android.content.Context context)
initFromForeground(String, Context, boolean, InitResultHandler)
.appId
- Application ID which you can get by creating the application at SendBird Dashboard.context
- Context
of Application
.public static void initFromForeground(java.lang.String appId, android.content.Context context, boolean useCaching, InitResultHandler handler)
appId
- Application ID which you can get by creating the application at SendBird Dashboard.context
- Context
of Application
.useCaching
- Determine whether to use local caching in the SDK.handler
- Handler to receive SendBird.init function call processing results.
Application ID can be changed by calling this with different application IDs.
Notice that only on CLOSED connection status application ID can be modified.public static boolean isUsingLocalCaching()
@Deprecated public static void notifyActivityResumedForOldAndroids()
setAutoBackgroundDetection(boolean)
to
true
, you do not need to call this function manually.Activity
being started.
This MUST be called on every Activity#onResume() in the application,
so that it can receive push notifications (GCM).
If the application runs only above Android 4.0, this method can be ignored.
@Deprecated public static void notifyActivityPausedForOldAndroids()
setAutoBackgroundDetection(boolean)
to
true
, you do not need to call this function manually.Activity
being paused.
This MUST be called on every Activity#onPause() in the application,
so that it can receive push notifications (GCM).
If the application runs only above Android 4.0, this method can be ignored.
public static void setAutoBackgroundDetection(boolean enable)
Application
is in background automatically.
SendBird by default tracks the Application
state by being notified
Activity#onResume() and Activity#onPause() event in the Application
.
This enables connection is automatically made or closed when Application
goes foreground or background respectively.
This auto-detection renders Application
can receive push notifications (FCM) without calling disconnect(DisconnectHandler)
explicitly.
You can be notified when your Application
goes foreground and connection is reestablished with
SendBird.ConnectionHandler.onReconnectSucceeded()
callback (refer to SendBird.ConnectionHandler
and addConnectionHandler(String, ConnectionHandler)
).
If you want the Application
not to act like in background so connection to still open,
for instance when you start external gallery Activity
to send photos from you Application
,
set this as false with such as Activity.startActivityForResult(Intent, int)
call and then set true again at Activity#onResume().
enable
- If true, automatic Application
state tracking is on. It is true by default.public static boolean getAutoBackgroundDetection()
setAutoBackgroundDetection(boolean)
.true
if auto background detection is on.public static void setNetworkAwarenessReconnection(boolean enable)
enable
- If true, the reconnection by network awareness is on. It is true by default.public static boolean getNetworkAwarenessReconnection()
setNetworkAwarenessReconnection(boolean)
.true
if network awareness reconnection is on.public static SendBird.ConnectionState getConnectionState()
public static void connect(java.lang.String userId, SendBird.ConnectHandler handler)
User
ID.
If you have created User
s with access token,
refer to connect(String, String, ConnectHandler)
.User
is not created by Platform API, this method creates one and calls callback to return it.userId
- User
ID to connect with. Refer to User.getUserId()
.handler
- Callback handler.public static void connect(java.lang.String userId, java.lang.String accessToken, SendBird.ConnectHandler handler)
User
ID and access token.
If you have created User
s without access token,
refer to connect(String, ConnectHandler)
or just pass access token with null
.userId
- User
ID to connect with. Refer to User.getUserId()
.accessToken
- Access token. It should not be saved on the client side. Set null if not used.handler
- Callback handler.public static void connect(java.lang.String userId, java.lang.String accessToken, java.lang.String apiHost, java.lang.String wsHost, SendBird.ConnectHandler handler)
User
ID and access token.
If you have created User
s without access token,
refer to connect(String, ConnectHandler)
or just pass access token with null
.userId
- User
ID to connect with. Refer to User.getUserId()
.accessToken
- Access token. It should not be saved on the client side.apiHost
- Custom API Host. Internal use only.wsHost
- Custom WS Host. Internal use only.handler
- Callback handler.public static boolean reconnect()
SendBird.ConnectionHandler.onReconnectFailed()
or where you check the device network status
to let the SDK try reconnection. SendBird.ConnectionHandler.onReconnectStarted()
will be called after you call
this (note that it will not be called if there is previously started connection process which has not finished),
and SendBird.ConnectionHandler.onReconnectFailed()
or SendBird.ConnectionHandler.onReconnectSucceeded()
will be
called according to the connection status afterwards.true
if there is previously and successfully connected user information,
false
otherwise. When false
is returned, please try with
connect(String, ConnectHandler)
or connect(String, String, ConnectHandler)
.public static void setSessionHandler(SessionHandler sessionHandler)
SessionHandler
which is required for SDK refresh the session when the current session expires.
Must be set before the connection is made by connect(String, ConnectHandler)
,
connect(String, String, ConnectHandler)
or connect(String, String, String, String, ConnectHandler)
.sessionHandler
- SessionHandler
to handle session related events.public static void addChannelHandler(java.lang.String identifier, SendBird.ChannelHandler handler)
identifier
- ID of handler to be added.handler
- Handler to be added.public static SendBird.ChannelHandler removeChannelHandler(java.lang.String identifier)
identifier
- ID of handler to be removed.public static void removeAllChannelHandlers()
addChannelHandler(String, ChannelHandler)
.public static void addUserEventHandler(java.lang.String identifier, SendBird.UserEventHandler handler)
identifier
- ID of handler to be added.handler
- Handler to be added.public static SendBird.UserEventHandler removeUserEventHandler(java.lang.String identifier)
identifier
- ID of handler to be removed.public static void removeAllUserEventHandlers()
addUserEventHandler(String, UserEventHandler)
.public static void addConnectionHandler(java.lang.String identifier, SendBird.ConnectionHandler handler)
identifier
- ID of handler to be added.handler
- Handler to be added.public static SendBird.ConnectionHandler removeConnectionHandler(java.lang.String identifier)
identifier
- ID of handler to be removed.public static void removeAllConnectionHandlers()
addConnectionHandler(String, ConnectionHandler)
.public static void disconnect(SendBird.DisconnectHandler handler)
handler
- Callback handler.public static void disconnectWebSocket(SendBird.DisconnectHandler handler)
handler
- Callback handler.[disconnect]
public static AppInfo getAppInfo()
public static User getCurrentUser()
User
.User
. If SendBird is not connected, null
is returned.public static long getLastConnectedAt()
@Deprecated public static UserListQuery createUserListQuery()
createApplicationUserListQuery()
.User
list.@Deprecated public static UserListQuery createUserListQuery(java.util.List<java.lang.String> userIds)
createApplicationUserListQuery()
with ApplicationUserListQuery.setUserIdsFilter(List)
.User
list by User
IDs.userIds
- User
IDs to query.public static ApplicationUserListQuery createApplicationUserListQuery()
User
list.public static BlockedUserListQuery createBlockedUserListQuery()
User
(by me) list.public static void updateCurrentUserInfoWithProfileImage(java.lang.String nickname, java.io.File profileImage, SendBird.UserInfoUpdateHandler handler)
User
's information.nickname
- Nickname to be used.profileImage
- Image file to be used.handler
- Callback handler.public static void updateCurrentUserInfo(java.lang.String nickname, java.lang.String profileUrl, SendBird.UserInfoUpdateHandler handler)
User
's information.nickname
- Nickname to be used.profileUrl
- Image URL to be used.handler
- Callback handler.public static void updateCurrentUserInfo(java.util.List<java.lang.String> preferredLanguages, SendBird.UserInfoUpdateHandler handler)
User
's information.preferredLanguages
- Preferred languages for push translation. Shouldn't be null
.handler
- Callback handler.public static java.lang.String getPendingPushToken()
null
if there is no registration pending token.@Deprecated public static void registerPushTokenForCurrentUser(java.lang.String gcmRegToken, SendBird.RegisterPushTokenHandler handler)
registerPushTokenForCurrentUser(String, RegisterPushTokenWithStatusHandler)
.User
to receive push notification.
To enable push notification and get a token, refer to SendBird Docs.gcmRegToken
- GCM push token.handler
- Callback handler.public static void registerPushTokenForCurrentUser(java.lang.String gcmRegToken, SendBird.RegisterPushTokenWithStatusHandler handler)
User
to receive push notification.
To enable push notification and get a token, refer to SendBird Docs.connect(String, ConnectHandler)
, connect(String, String, ConnectHandler)
) is made.
Otherwise, callback will return with SendBird.PushTokenRegistrationStatus.PENDING
status. Then, you can register push token again by calling
SendBird.registerPushTokenForCurrentUser(SendBird.getPendingPushToken(), RegisterPushTokenWithStatusHandler)
after the connection is done.
This just adds token to the server. If you want to register this token and delete all the previous ones, refer to registerPushTokenForCurrentUser(String, boolean, RegisterPushTokenWithStatusHandler)
.gcmRegToken
- GCM push token.handler
- Callback handler.public static void registerPushTokenForCurrentUser(java.lang.String gcmRegToken, boolean unique, SendBird.RegisterPushTokenWithStatusHandler handler)
User
to receive push notification.
To enable push notification and get a token, refer to SendBird Docs.connect(String, ConnectHandler)
, connect(String, String, ConnectHandler)
) is made.
Otherwise, callback will return with SendBird.PushTokenRegistrationStatus.PENDING
status. Then, you can register push token again by calling
SendBird.registerPushTokenForCurrentUser(SendBird.getPendingPushToken(), unique, RegisterPushTokenWithStatusHandler)
after the connection is done.gcmRegToken
- GCM push token.unique
- If true, all the previously registered token for the current User
will be deleted and this token will be the unique one.handler
- Callback handler.public static void unregisterPushTokenForCurrentUser(java.lang.String gcmRegToken, SendBird.UnregisterPushTokenHandler handler)
User
.gcmRegToken
- GCM push token.handler
- Callback handler.public static void unregisterPushTokenAllForCurrentUser(SendBird.UnregisterPushTokenHandler handler)
User
.handler
- Callback handler.public static void getMyPushTokensByToken(java.lang.String token, SendBird.PushTokenType type, SendBird.GetPushTokensHandler handler)
handler
.token
- Token to get next push tokens. If token is null
, the result will be passed from the beginning.type
- PushTokenType. Refer to SendBird.PushTokenType
.handler
- Callback handler.public static void setDoNotDisturb(boolean doNotDisturbOn, int startHour, int startMin, int endHour, int endMin, java.lang.String timezone, SendBird.SetDoNotDisturbHandler handler)
User
.
If this option is enabled, the current User
does not receive push notification during the specified time repeatedly.
If you want to snooze specific period, use setSnoozePeriod(boolean, long, long, SetSnoozePeriodHandler)
.doNotDisturbOn
- Enables option or not.startHour
- Start hour (0~23).startMin
- Start minute (0~59).endHour
- End hour (0~23).endMin
- End minute (0~59).timezone
- Timezone. TimeZone.getID()
can be used to get the current timezone.handler
- Callback handler.public static void getDoNotDisturb(SendBird.GetDoNotDisturbHandler handler)
User
.handler
- Callback handler.public static void setSnoozePeriod(boolean snoozeOn, long startTs, long endTs, SendBird.SetSnoozePeriodHandler handler)
User
.
If this option is enabled, the current User
does not receive push notification during the given period. It's not a repetitive operation.
If you want to snooze repeatedly, use setDoNotDisturb(boolean, int, int, int, int, String, SetDoNotDisturbHandler)
.snoozeOn
- Enables option or not.startTs
- Start timestamp of snooze periodendTs
- End timestamp of snooze periodhandler
- Callback handler.public static void getSnoozePeriod(SendBird.GetSnoozePeriodHandler handler)
User
.handler
- Callback handler.public static void setPushSound(java.lang.String sound, SendBird.SetPushSoundHandler handler)
User
.
This setting will be delivered on push notification payload.sound
- Sound file path.handler
- Callback handler.public static void getPushSound(SendBird.GetPushSoundHandler handler)
User
.handler
- Callback handler.public static void setPushTemplate(java.lang.String templateName, SendBird.SetPushTemplateHandler handler)
User
. The only valid arguments for template name are PUSH_TEMPLATE_DEFAULT
and PUSH_TEMPLATE_ALTERNATIVE
.
If PUSH_TEMPLATE_DEFAULT
is set, the push notification will contain the original message in the message
field of the push notification.
If PUSH_TEMPLATE_ALTERNATIVE
is set, message
of push notification will be replaced by the content you've set on
SendBird Dashboard.templateName
- Name of template to be applied to current User
.handler
- Callback handler.public static void getPushTemplate(SendBird.GetPushTemplateHandler handler)
User
. For details of push template option, refer to setPushTemplate(String, SetPushTemplateHandler)
.
This can be used, for instance, when you need to check the push notification content preview is on or off at the moment.handler
- Callback handler.public static void setPushTriggerOption(SendBird.PushTriggerOption pushTriggerOption, SendBird.SetPushTriggerOptionHandler handler)
User
's push trigger option.
If certain channel's push trigger option is set to GroupChannel.PushTriggerOption.DEFAULT
, it works according to the state of SendBird.PushTriggerOption
.
If not, push messages will be triggered according to the state of GroupChannel.PushTriggerOption
.
Refer to GroupChannel.PushTriggerOption
.pushTriggerOption
- PushTriggerOption
. Refer to SendBird.PushTriggerOption
.handler
- Callback handler.public static void getPushTriggerOption(SendBird.GetPushTriggerOptionHandler handler)
User
's push trigger option. Refer to SendBird.PushTriggerOption
.
For details of push trigger option, refer to setPushTriggerOption(PushTriggerOption, SetPushTriggerOptionHandler)
.handler
- Callback handler.public static void setChannelInvitationPreference(boolean autoAccept, SendBird.SetChannelInvitationPreferenceHandler handler)
User
's preference for GroupChannel
join.
If this is set as true
, the User
will automatically join the GroupChannel
.
If set as false
, the User
can join the GroupChannel
by calling
GroupChannel.acceptInvitation(GroupChannel.GroupChannelAcceptInvitationHandler)
or decline the invitation by calling GroupChannel.declineInvitation(GroupChannel.GroupChannelDeclineInvitationHandler)
.autoAccept
- GroupChannel
invitation auto-acceptance preference.handler
- Callback handler.public static void getChannelInvitationPreference(SendBird.GetChannelInvitationPreferenceHandler handler)
User
's preference for GroupChannel
join.
If this is set as true
, the User
will automatically join the GroupChannel
.
If set as false
, the User
can join the GroupChannel
by calling
GroupChannel.acceptInvitation(GroupChannel.GroupChannelAcceptInvitationHandler)
or decline the invitation by calling GroupChannel.declineInvitation(GroupChannel.GroupChannelDeclineInvitationHandler)
.handler
- Callback handler.public static void blockUser(User userToBlock, SendBird.UserBlockHandler handler)
User
.
Blocked User
cannot send messages to the blocker.userToBlock
- User
to block.handler
- Callback handler.public static void blockUserWithUserId(java.lang.String userIdToBlock, SendBird.UserBlockHandler handler)
User
ID.
Blocked User
cannot send messages to the blocker.userIdToBlock
- User
ID to block.handler
- Callback handler.public static void unblockUser(User blockedUser, SendBird.UserUnblockHandler handler)
User
.
Unblocked User
can send messages to the ex-blocker.blockedUser
- User
to unblock.handler
- Callback handler.public static void unblockUserWithUserId(java.lang.String blockedUserId, SendBird.UserUnblockHandler handler)
User
ID.
Unblocked User
cannot send messages to the ex-blocker.blockedUserId
- User
ID to unblock.handler
- Callback handler.public static void addFriends(java.util.List<java.lang.String> userIds, SendBird.AddFriendsHandler handler)
userIds
- User
IDs to add friends.handler
- Callback handler.public static void deleteFriends(java.util.List<java.lang.String> userIds, SendBird.DeleteFriendsHandler handler)
userIds
- User
IDs to delete friends.handler
- Callback handler.public static void deleteFriend(java.lang.String userId, SendBird.DeleteFriendHandler handler)
userId
- User
ID to delete friend.handler
- Callback handler.public static void uploadFriendDiscoveries(java.util.Map<java.lang.String,java.lang.String> discoveryMap, SendBird.UploadFriendDiscoveriesHandler handler)
addUserEventHandler(String, com.sendbird.android.SendBird.UserEventHandler)
removeUserEventHandler(String)
removeAllUserEventHandlers()
SendBird.UserEventHandler.onFriendsDiscovered(List)
discoveryMap
- The discovery key, friend name map to upload friend discoveries.handler
- Callback handler.public static void deleteFriendDiscoveries(java.util.List<java.lang.String> discoveryKeys, SendBird.DeleteFriendDiscoveriesHandler handler)
discoveryKeys
- The discovery keys to delete friend discoveries.handler
- Callback handler.public static void deleteFriendDiscovery(java.lang.String discoveryKey, SendBird.DeleteFriendDiscoveryHandler handler)
discoveryKey
- The discovery key to delete friend discovery.handler
- Callback handler.public static void getFriendChangeLogsByToken(java.lang.String token, SendBird.GetFriendChangeLogsByTokenHandler handler)
token
- Token to get next friend changelogs. If the token is null, the result will be passed from the beginning.handler
- Callback handler.public static FriendListQuery createFriendListQuery()
@Deprecated public static void getMyGroupChannelChangeLogsByToken(java.lang.String token, java.util.List<java.lang.String> customTypes, SendBird.GetMyGroupChannelChangeLogsHandler handler)
getMyGroupChannelChangeLogsByTokenWithParams(String, GroupChannelChangeLogsParams, GetMyGroupChannelChangeLogsHandler)
.handler
.token
- Token to get next channel changelogs. If the token is null, the result will be passed from the beginning.customTypes
- GroupChannel
custom types filter.handler
- Callback handler.@Deprecated public static void getMyGroupChannelChangeLogsByTimestamp(long ts, java.util.List<java.lang.String> customTypes, SendBird.GetMyGroupChannelChangeLogsHandler handler)
getMyGroupChannelChangeLogsByTimestampWithParams(long, GroupChannelChangeLogsParams, GetMyGroupChannelChangeLogsHandler)
.handler
.ts
- Timestamp to load changelogs. Changelogs after this timestamp will be returned.customTypes
- GroupChannel
custom types filter. If this is null, the changelogs of all channels will be returned.handler
- Callback handler.@Deprecated public static void getMyGroupChannelChangeLogsByToken(java.lang.String token, java.util.List<java.lang.String> customTypes, boolean includeEmpty, SendBird.GetMyGroupChannelChangeLogsHandler handler)
getMyGroupChannelChangeLogsByTokenWithParams(String, GroupChannelChangeLogsParams, GetMyGroupChannelChangeLogsHandler)
.handler
.token
- Token to get next channel changelogs. If the token is null, the result will be passed from the beginning.customTypes
- GroupChannel
custom types filter.includeEmpty
- Flag to include empty channels.handler
- Callback handler.@Deprecated public static void getMyGroupChannelChangeLogsByTimestamp(long ts, java.util.List<java.lang.String> customTypes, boolean includeEmpty, SendBird.GetMyGroupChannelChangeLogsHandler handler)
getMyGroupChannelChangeLogsByTimestampWithParams(long, GroupChannelChangeLogsParams, GetMyGroupChannelChangeLogsHandler)
.handler
.ts
- Timestamp to load changelogs. Changelogs after this timestamp will be returned.customTypes
- GroupChannel
custom types filter. If this is null, the changelogs of all channels will be returned.includeEmpty
- Flag to include empty channels.handler
- Callback handler.public static void getMyGroupChannelChangeLogsByTokenWithParams(java.lang.String token, GroupChannelChangeLogsParams params, SendBird.GetMyGroupChannelChangeLogsHandler handler)
handler
.token
- Token to get next channel changelogs. If the token is null, the result will be passed from the beginning.params
- Params for getting group channel list. See GroupChannelChangeLogsParams
handler
- Callback handler.public static void getMyGroupChannelChangeLogsByTimestampWithParams(long ts, GroupChannelChangeLogsParams params, SendBird.GetMyGroupChannelChangeLogsHandler handler)
handler
.ts
- Timestamp to load changelogs. Changelogs after this timestamp will be returned.params
- Params for getting group channel list. See GroupChannelChangeLogsParams
handler
- Callback handler.@Deprecated public static void markAsDelivered(java.lang.String channelUrl)
markAsDelivered(Map)
.channelUrl
- target channel's urlpublic static void markAsDelivered(java.util.Map<java.lang.String,java.lang.String> data)
data
- The payload data from the push.
com.google.firebase.messaging.RemoteMessage#getData()
for FCM,
com.huawei.hms.push.RemoteMessage#getDataOfMap()
for HMS.public static void markAsReadAll(SendBird.MarkAsReadHandler handler)
GroupChannel
s.
This method has rate limit. You can send one request per second.
It returns SendBirdException if you exceed the rate limit.handler
- Callback handler.public static void markAsReadWithChannelUrls(java.util.List<java.lang.String> channelUrls, SendBird.MarkAsReadHandler handler)
GroupChannel
s.
This method has rate limit. You can send one request per second.
It returns SendBirdException if you exceed the rate limit.channelUrls
- Channel Urls.handler
- Callback handler.public static void getAllEmoji(SendBird.GetAllEmojiHandler handler)
handler
.handler
- Callback handler.public static void getEmojiCategory(long emojiCategoryId, SendBird.GetEmojiCategoryHandler handler)
handler
.emojiCategoryId
- Emoji category id.handler
- Callback handler.public static void getEmoji(java.lang.String key, SendBird.GetEmojiHandler handler)
handler
.key
- Emoji key.handler
- Callback handler.public static void getTotalUnreadMessageCount(GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
GroupChannel
s the current user has joined.handler
- Callback handler.public static void getTotalUnreadMessageCount(java.util.List<java.lang.String> channelCustomTypes, GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
GroupChannel
s with channel custom types filter.channelCustomTypes
- GroupChannel
custom type list.handler
- Callback handler.public static void getTotalUnreadMessageCount(GroupChannelTotalUnreadMessageCountParams params, GroupChannel.GroupChannelTotalUnreadMessageCountHandler handler)
GroupChannel
s with GroupChannelTotalUnreadMessageCountParams
filter.params
- GroupChannelTotalUnreadMessageCountParams
handler
- Callback handler.public static int getSubscribedTotalUnreadMessageCount()
GroupChannel
s the current user has joined.public static int getSubscribedCustomTypeTotalUnreadMessageCount()
GroupChannel
s with subscribed custom types.public static int getSubscribedCustomTypeUnreadMessageCount(java.lang.String customType)
GroupChannel
with subscribed custom type.customType
- The subscribed custom type.public static void getUnreadItemCount(java.util.Collection<GroupChannel.UnreadItemKey> keys, GroupChannel.GroupChannelGetUnreadItemCountHandler handler)
GroupChannel
s from keys.keys
- Unread item keys. Refer to GroupChannel.UnreadItemKey
.handler
- Callback handler.public static void getTotalUnreadChannelCount(GroupChannel.GroupChannelTotalUnreadChannelCountHandler handler)
GroupChannel
s the current user has joined.handler
- Callback handler.public static void getTotalUnreadChannelCount(GroupChannelTotalUnreadChannelCountParams params, GroupChannel.GroupChannelTotalUnreadChannelCountHandler handler)
GroupChannel
s the current user has joined.params
- GroupChannelTotalUnreadChannelCountParams
.handler
- Callback handler.public static void getGroupChannelCount(GroupChannelListQuery.MemberStateFilter memberStateFilter, GroupChannel.GroupChannelChannelCountHandler handler)
GroupChannel
s.memberStateFilter
- GroupChannelListQuery.MemberStateFilter
.handler
- Callback handler.public static java.lang.String getEkey()
FileMessage.getPlainUrl()
,
User.getPlainProfileImageUrl()
and FileMessage.Thumbnail.getPlainUrl()
.
This key has to be put into the HTTP header to access the url provided by above methods.public static void allowFriendDiscovery(boolean allow, AllowFriendDiscoveryHandler handler)
allow
- true to allow, false to disallow.handler
- a completion handler to get notified of complete event. Can be null.public static void getAllowFriendDiscovery(GetAllowFriendDiscoveryHandler handler)
handler
- A handler to get notified of the result. Copyright © 2021, Sendbird or its affiliates. All rights reserved.
Report a bug or request a feature
For further developer documentation, see Chat SDK Documentation. That documentation contains more detailed descriptions, conceptual overviews, definitions of terms, and code examples.