On the Android device side, developers need to run an Android application (also referred to as the Mini Program Launcher in the documentation) to perform operations such as device registration and making VOIP calls via Mini Program.
1. Integrate WMPF and Run Mini Program
On the Android platform, the Mini Program video call capability is implemented in Mini Program. The Android application running on the device must launch the developer-built Mini Program to initiate and receive audio and video calls.
After completing the development preparation "3.1 Integrate WeChat Hardware Platform" and registering the device, you can obtain the hardware information required for WMPF operation, such as productId, keyVersion, deviceId, and signature.
Please refer to the instructions in the WMPF Documentation and perform the following operations:
- Deploy the WMPF Service APK;
- Integrate the WMPF Client in your application by referring to the sample code provided by WMPF;
- Call activateDevice to complete device activation;
2. Device Registration
Before initiating a call, you must first complete device registration. Refer to the Device Authentication Documentation for steps on deploying the RPMBD service, integrating the SDK, and registering the device.
After completing device registration, you can use the getDeviceToken interface of the SDK to obtain the device ticket before initiating a call. This ticket is then passed to Mini Program as the voipToken used to invoke the VOIP plugin and initiate the call.
Note:
- The SN used here must be registered as a
deviceIdvia the WMPF addDevice interface and must match thedeviceIdused for WMPF Device Activation. Otherwise, subsequent call initiation will fail. - Ensure that the RPMBD service is running successfully when using the Device Authentication SDK.
3. Run Mini Program
After completing the WMPF installation and device activation, you can invoke launchMiniProgram to launch the specified Mini Program.
3.1 Communication between Android Apps and Mini Program
After Mini Program is launched, the app can communicate with Mini Program using the following methods:
- For simple one-way, one-time parameter passing from the Android app to Mini Program, you can directly append the query to the path used to launch Mini Program.
- If the Android app needs to receive events from Mini Program, requires bidirectional communication, or handles large amounts of data, you can use the Invoke Channel provided by WMPF.
3.2 Running the Development/Experience Version Mini Program
When debugging with the development/experience version Mini Program, please follow the steps below.
Note: You must log in via QR code scanning to successfully download the development/experience version. After updating the development/experience version, it is recommended to restart WMPF to update to the latest version.
- Developers should click "Preview" in the Developer Tools to upload the development version Mini Program code package to the backend. You can also submit it as an experience version;
- On WMPF, call login to display the QR code login interface. The same WeChat ID logged in on the Developer Tools should scan the QR code to log in;
- When calling launchMiniProgram on WMPF, specify the appType as the development version or experience version;
- The development version has an expiration date. After it expires, the above steps need to be repeated.