Create User / Login
Hive TalkPlus supports token-based login. To use token-based login, you must call HiveTalkPlus.loginWithToken()
that enables to create users and log in after obtaining the token by calling AuthV4.getHiveTalkPlusLoginToken()
.
Token User
You need a playerId, loginToken, and user’s nickname to log in.
- userId is returned by adding
playerId
to theAuthV4.getPlayerInfo()
method. - The
AuthV4.getHiveTalkPlusLoginToken()
method creates loginToken.
1 2 3 4 5 6 7 8 9 |
// loginToken is AuthV4.getHiveTalkPlusLoginToken(); HiveTalkPlusApi.LoginWithToken(userId, loginToken, username, profileImageUrl, metaData, (HiveTalkPlusUser user) => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
// loginToken is AuthV4.getHiveTalkPlusLoginToken() // Specify an image URL directly HiveTalkPlus.loginWithToken(userId, loginToken, username, profileImageUrl, metaData, object : HiveTalkPlus.CallbackListener<HiveTalkPlusUser?> { override fun onSuccess(user: HiveTalkPlusUser?) {} override fun onFailure(i: Int, e: Exception?) {} }) // Upload an image file HiveTalkPlus.loginWithToken(userId, loginToken, username, profileImageFile, metaData, object : HiveTalkPlus.CallbackListener<HiveTalkPlusUser?> { override fun onSuccess(user: HiveTalkPlusUser?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
// loginToken is AuthV4.getHiveTalkPlusLoginToken(); // Specify an image URL directly HiveTalkPlus.login(withToken: loginToken, userId: userId, username: username, profileImageUrl : profileImageUrl , metaData: metaData, success: { user in // SUCCESS }, failure: { errorCode, error in // FAILURE }) // Upload an image file HiveTalkPlus.login(withToken: loginToken, userId: userId, username: username, profileImage: profileImage, metaData: metaData, success: { user in // SUCCESS }, failure: { errorCode, error in // FAILURE }) |
Update User Information
You can update username and profile image URL.
1 2 3 4 5 |
HiveTalkPlusApi.UpdateUserProfile(username, profileImageUrl, metaData, (HiveTalkPlusUser user) => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Specify an image URL directly HiveTalkPlus.updateUserProfile(username, profileImageUrl, metaData, object : HiveTalkPlus.CallbackListener<HiveTalkPlusUser?> { override fun onSuccess(user: HiveTalkPlusUser?) {} override fun onFailure(i: Int, e: Exception?) {} }) // Upload an image file HiveTalkPlus.updateUserProfile(username, profileImageFile, metaData, object : HiveTalkPlus.CallbackListener<HiveTalkPlusUser?> { override fun onSuccess(user: HiveTalkPlusUser?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
// Specify an image URL directly HiveTalkPlus.updateUserProfile(username, profileImageUrl: profileImageUrl, metaData: metaData, success: { user in // SUCCESS }, failure: { errorCode, error in // FAILURE }) // Upload an image file HiveTalkPlus.updateUserProfile(username, profileImage: profileImage, metaData: metaData, success: { user in // SUCCESS }, failure: { errorCode, error in // FAILURE }) |
Block / Unblock
1. View Blocked Users
You can view blocked users. The list is paginated so you can use the last HiveTalkPlusUser
from the previous list to fetch the next page.
1 2 3 4 5 |
HiveTalkPlusApi.GetBlockedUserList(lastUser, (List<HiveTalkPlusUser> users) => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 |
HiveTalkPlus.getBlockedUserList(lastUser, object : HiveTalkPlus.CallbackListener<List<HiveTalkPlusUser?>?> { override fun onSuccess(users: List<HiveTalkPlusUser?>?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 |
HiveTalkPlus.getBlockedUserList(lastUser, success: { users in // SUCCESS }, failure: { errorCode, error in // FAILURE }) |
2. Block / Unblock Users
You can block or unblock users.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
// Block HiveTalkPlusApi.BlockUser(targetId, () => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); // Unblock HiveTalkPlusApi.UnblockUser(targetId, () => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 5 6 7 8 9 10 11 12 |
// Block HiveTalkPlus.blockUser(userId, object : HiveTalkPlus.CallbackListener<Unit?> { override fun onSuccess(unit: Unit?) {} override fun onFailure(i: Int, e: Exception?) {} }) // Unblock HiveTalkPlus.unblockUser(userId, object : HiveTalkPlus.CallbackListener<Unit?> { override fun onSuccess(unit: Unit?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 6 7 8 9 10 11 |
HiveTalkPlus.blockUser(targetId, success: { // SUCCESS }, failure: { errorCode, error in // FAILURE }) // Unblock HiveTalkPlus.unblockUser(targetId, success: { // SUCCESS }, failure: { errorCode, error in // FAILURE }) |
Please refer to the following limitations:
Whether I can add someone whom I’ve blocked to a channel that I own | X |
Whether someone whom I’ve blocked can join a channel that I own | X |
Whether someone whom I’ve blocked can be added as a member to a channel that I am a member of | O |
Whether someone whom I’ve blocked can join a channel that I am a member of | O |
Whether I can be added as a member to a channel that is owned by someone I’ve blocked | X |
Whether I can join a channel that is owned by someone I’ve blocked | X |
Whether I can be added as a member to a channel where someone I’ve blocked is a member of | O |
Whether I can join a channel where someone I’ve blocked is a member of | O |
Logout
Logging out disconnects current user from FCM service and terminates all realtime connections maintained by TalkPlus.
1 2 3 4 5 |
HiveTalkPlusApi.Logout(() => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 |
HiveTalkPlus.logout(object : HiveTalkPlus.CallbackListener<Unit?> { override fun onSuccess(unit: Unit?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 |
HiveTalkPlus.logout(success: { // SUCCESS }, failure: { errorCode, error in // FAILURE }) |
Delete
You can delete users. No more connect the deleted users from FCM service and all real-time connections with Hive TalkPlus are terminated.
1 2 3 4 5 |
HiveTalkPlusApi.DeleteUser(() => { // SUCCESS }, (int statusCode, Exception e) => { // FAILURE }); |
1 2 3 4 |
HiveTalkPlus.deleteUser(object : HiveTalkPlus.CallbackListener<Unit?> { override fun onSuccess(unit: Unit?) {} override fun onFailure(i: Int, e: Exception?) {} }) |
1 2 3 4 5 |
HiveTalkPlus.deleteUser(success: { // SUCCESS }, failure: { errorCode, error in // FAILURE }) |