Skip to content

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

  1. Integrate the SDK into your Android project (contact Weiyi Pro support for the AAR / Gradle coordinates).
  2. Declare camera, microphone, and network permissions in AndroidManifest.xml.
  3. Set apiUrl to your deployed Weiyi Pro Web Server API base URL (HTTPS recommended).
  4. Call init() before any other SDK method.

1. Initialize the SDK

1.1 Basic initialization

java
public void init(Context appContent, String apiUrl)
java
WySdk.getInstance().init(getApplicationContext(), "https://api.example.com");

1.2 With audio enhancement (AEC/NS)

java
public void init(Context appContent, String apiUrl, boolean useAEC_NS)
java
WySdk.getInstance().init(getApplicationContext(), "https://api.example.com", true);

2. Check meeting info

2.1 Without password

java
public void checkMeeting(Context context, String serial, WyCallback<WyMeetingResponse> callback)

2.2 With password

java
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

MethodPurpose
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

java
public void joinMeeting(AppCompatActivity activity, String userId,
                        String nickName, String serial, String sig,
                        @RoleType.Type String role)
RoleConstant
ParticipantRoleType.USER
SpeakerRoleType.SPEAKER
ChairmanRoleType.CHAIRMAN

Pass null for sig when the meeting has no password.

4.2 HD join

java
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:

java
public void creatLocalUser(boolean openCamera, String nickName, String mdeviceId,
                          String userId, String role, String userDeviceType)

6. Publish and subscribe streams

ActionAPI
Create local videocreatLocalVideoStream(deviceId) or with width/height/fps
Publish videopublishVideo(videoDeviceId)
Publish audiopublishAudio()
Subscribe remote videosubscribeVideo(wySurface, wyStreamBean)
Subscribe remote audiosubscribeAudio(remoteUser)

Default video profile: 1280×720 @ 30 fps.


7. Join flow

init → set observers → checkMeeting → joinMeeting
  → onJoinSuccess → creatLocalUser → creatLocalVideoStream
  → publishVideo + publishAudio → subscribe remote streams

A complete MeetingActivity sample is in the Chinese Android SDK guide.


8. Other APIs

java
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

ItemVersion
SDK3.0.1
Doc1.0
Updated2025-06-05

Server-side APIs: Web Server API. Contact Weiyi Pro support for SDK packages and Gradle integration details.

微议Pro SDK 开发者文档