このページは現在英語版のみで提供されており、日本語版も近日中に提供される予定です。ご利用いただきありがとうございます。

Android

Description of the Feature

In Voice Chat Scenarios, the Follow the host feature is an important Interactive Mode. It allows viewers to follow specific hosts, thereby establishing long-term interaction and attention relationships on the Live streaming platform. The Follow the host feature in TUILiveKit has been implemented Via Chat.
Follow feature allows users to choose other users they are interested in so that they can get the latest updates, posts, or event information promptly. You can provide personalized content recommendations based on the user's Follow list.
Fans feature refers to the status of a user being followed by others. When User A follows User B, A becomes a Fan of B.
Through the Follow and Fans features, social applications and websites can create an active and interconnected user network, promoting the dissemination of information and the building of communities.

Use Instructions

Note:
TUILiveKit's Follow the host feature relies on the Chat Follow & Fan APIs, so you need to activate the related Package bundles for Chat. For details, please refer to the Follow&Fan documentation.
Unfollowed Status
Followed Status
Broadcaster Info Panel









Follow the host: You can click the

button in the live room information area at the top left corner of the live streaming interface to follow the host
Unfollow: You can click the

button in the live room information area at the top left corner of the live streaming interface to unfollow the host
View the host's fan count: You can click the live room information area at the top left corner of the live streaming interface to pop up the live room details panel, which will display the host's fan count.

feature customization

If the current UI does not meet your needs, you can modify the source code in the Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/common/uicomponent/roominfo directory to achieve your desired UI effects. For easier customization of the UI, here is an introduction to files related to the follow feature.
// File location:Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/common/uicomponent/

roominfo // Directory for implementing the live room information UI component
├── RoomInfoDetailView.java // Specific implementation of the Live Room Information Details Panel View
└── RoomInfoView.java // Specific implementation of the Live Room Information View. Clicking this view will show the Details Panel View

Key code

Follow anchor

Java
// File location: Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.java

List<String> userIDList = new ArrayList<>(); userIDList.add("userId");

V2TIMManager.getFriendshipManager().followUser(userIDList, new V2TIMValueCallback<List<V2TIMFollowOperationResult>>() { @Override public void onSuccess(List<V2TIMFollowOperationResult> results) { } @Override public void onError(int code, String message) { } });

Unfollow anchor

Java
Option Two
// File location:Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.java

List<String> userIDList = new ArrayList<>(); userIDList.add("userId");

V2TIMManager.getFriendshipManager().unfollowUser(userIDList, new V2TIMValueCallback<List<V2TIMFollowOperationResult>>() { @Override public void onSuccess(List<V2TIMFollowOperationResult> results) { } @Override public void onError(int code, String message) { } });


View anchor's follow status

Java
// File location: Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.java

List<String> userIDList = new ArrayList<>(); userIDList.add("userId");

V2TIMManager.getFriendshipManager().checkFollowType(userIDList, new V2TIMValueCallback<List<V2TIMFollowTypeCheckResult>>() { @Override public void onSuccess(List<V2TIMFollowTypeCheckResult> results) { } @Override public void onError(int code, String message) { } });

Get number of followers

Java
Option Two
// File location: Android/tuilivekit/src/Main/java/com/trtc/uikit/livekit/service/impl/LiveServiceImpl.java

List<String> userIDList = new ArrayList<>(); userIDList.add("userId");

V2TIMManager.getFriendshipManager().getUserFollowInfo(userIDList, new V2TIMValueCallback<List<V2TIMFollowInfo>>() { @Override public void onSuccess(List<V2TIMFollowInfo> results) { } @Override public void onError(int code, String message) { } });