Android SDK
The Weiyi Pro Android SDK uses WySdk as the main entry class for creating and joining meetings, publishing and subscribing to audio/video streams. This guide covers the full join flow and related APIs.
Before You Start
- Integrate the SDK into your Android project (contact Weiyi Pro support for the AAR / Gradle coordinates).
- Declare camera, microphone, and network permissions in
AndroidManifest.xml. - Set
apiUrlto your deployed Weiyi Pro Web Server API base URL (HTTPS recommended). - Call
init()before any other SDK method.
1. Initialize the SDK
1.1 Basic initialization
public void init(Context appContent, String apiUrl)WySdk.getInstance().init(getApplicationContext(), "https://api.example.com");1.2 With audio enhancement (AEC/NS)
public void init(Context appContent, String apiUrl, boolean useAEC_NS)WySdk.getInstance().init(getApplicationContext(), "https://api.example.com", true);2. Check meeting info
2.1 Without password
public void checkMeeting(Context context, String serial, WyCallback<WyMeetingResponse> callback)2.2 With password
public void checkMeeting(Context context, String serial, String sig, WyCallback<WyMeetingResponse> callback)See the Chinese Android SDK guide for full callback examples and error codes (1001 meeting not found, 1002 wrong password).
3. Set observers
| Method | Purpose |
|---|---|
setWyObserver() | Main SDK events (leave meeting, errors) |
setStreamObserver() | Remote users and stream add/remove |
setMessageObserver() | Text messages |
setControlChairmanObserver() | Chairman control events |
addjoinSuccessListener() | Fires when join succeeds |
Register observers before calling joinMeeting().
4. Join a meeting
4.1 Standard join
public void joinMeeting(AppCompatActivity activity, String userId,
String nickName, String serial, String sig,
@RoleType.Type String role)| Role | Constant |
|---|---|
| Participant | RoleType.USER |
| Speaker | RoleType.SPEAKER |
| Chairman | RoleType.CHAIRMAN |
Pass null for sig when the meeting has no password.
4.2 HD join
public void joinHDMeeting(Activity activity, String userId,
String nickName, String serial,
@RoleType.Type String role)5. Create local user
After a successful join, create the local user:
public void creatLocalUser(boolean openCamera, String nickName, String mdeviceId,
String userId, String role, String userDeviceType)6. Publish and subscribe streams
| Action | API |
|---|---|
| Create local video | creatLocalVideoStream(deviceId) or with width/height/fps |
| Publish video | publishVideo(videoDeviceId) |
| Publish audio | publishAudio() |
| Subscribe remote video | subscribeVideo(wySurface, wyStreamBean) |
| Subscribe remote audio | subscribeAudio(remoteUser) |
Default video profile: 1280×720 @ 30 fps.
7. Join flow
init → set observers → checkMeeting → joinMeeting
→ onJoinSuccess → creatLocalUser → creatLocalVideoStream
→ publishVideo + publishAudio → subscribe remote streamsA complete MeetingActivity sample is in the Chinese Android SDK guide.
8. Other APIs
getScreenWidth() / getScreenHeight()
getLocalUser()
exitMeeting()
clear()
openCamera() / closeCamera() / switchCamera()
publishAudio() / unPublishAudio() / isAudioOpen()9. FAQ
Join failed — Check network, meeting serial/password, and apiUrl.
Join success — Implement JoinSuccessListener and handle onJoinSuccess().
Video not publishing — Ensure local user and video stream exist, and camera permission is granted.
Multi-device — Each device uses a unique deviceId from getDeviceId(context).
Version
| Item | Version |
|---|---|
| SDK | 3.0.1 |
| Doc | 1.0 |
| Updated | 2025-06-05 |
Server-side APIs: Web Server API. Contact Weiyi Pro support for SDK packages and Gradle integration details.
