Note
This Android voice integration document is intended for Android client developers only. Developers on other platforms do not need to do any extra work. As long as voice works on each platform, multi-platform voice co-viewing is supported automatically.
Caution
Before you begin, integrate the Realsee Android container SDK by following the official Domestic Android integration guide. The container guide is not duplicated in this overseas SDK documentation tree.
The SDK uses Tencent voice (TRTC) to implement voice synchronization during co-viewing. To use the co-viewing feature, follow the steps below:
Adding the Dependency
To avoid version conflicts, the SDK does not bundle the Tencent voice library into the aar, so you need to add the Tencent voice library separately. Modify the build.gradle file and add the dependency:
dependencies {
...
// Voice (Tencent Cloud)
api "com.tencent.liteav:LiteAVSDK_Professional:8.4.9947"
...
}Login Verification
Co-viewing requires verifying the user's login status. The SDK needs to obtain the current user's login token to validate it. If the validation result indicates that the user is not logged in or the login information is invalid, the SDK will actively redirect to the App login. The SDK triggers the App login through a callback interface.
RsVrSdk.init(this, new RsVrCallBack() {
@Override
public RsAppInfo appInfo() {
return new RsAppInfo() {
...
};
}
// Return the login token
@Override
public String accessToken() {
return Utils.getAccessToken();
}
// Return the user id
@Override
public String getUserId() {
return Utils.getUserId();
}
// Return the user name
@Override
public String getUserName() {
return Utils.getUserName();
}
// When the login token fails validation, redirect to the App login
@Override
public void actionLogin(Activity activity, int requestCode) {
Intent intent = new Intent(activity, GetUserIdActivity.class);
activity.startActivityForResult(intent, requestCode);
}
});