# Using WMPF certified devices (Android)
After system integration rpmbd, if the Weixin Mini Program hardware framework (WMPF) is installed on the device, you can use WMPF to authenticate the device directly.
Registering devices with WMPF has the following advantages over using the device authentication SDK:
- Low access cost: No additional device authentication SDK is required, no packet size is occupied, and access costs are lower.
- Maintenance-free device credentials:
deviceTokenis acquired by the framework on demand, developers only need to register the device, no maintenancedeviceToken, also does not need to be manually passed to Weixin Mini Program, lower maintenance costs.
Be careful
- Note 1: When using WMPF, you need to ensure that the rmpbd service is running properly.
- Note 2: Devices registered with the Device Authentication SDK will need to re-register with WMPF to be maintenance-free.
Specific use can refer to sample code
# 1. Version requirements
- WMPF: This ability requires Android WMPF > = 1.2.0 version support (if it is downloaded before 2023 / 08 / 19 wmpf-cli, need to re-download the update).
- VOIP Calling Plug-in: Plug-in > = 2.3.0 support required.
# 2. Register a device
Device registration using registerMiniProgramDevice .Use getMiniProgramDeviceInfo to perform registration letter queries.
# 3. Equipment credentials are pre-drawn
When a device is registered with WMPF, the framework acquires the device credentials on demand without developer intervention.To optimize the time required to obtain device credentials, developers can call the prefetchDeviceToken interface to prefetch the device credential before it is likely to be used. During the validity period (currently 1 hour), the framework can be obtained directly from the cache.
For example, when initiating an audio / video call, the framework getsdeviceToken.Developers are advised to pre-pull device credentials on the front page (e.g. contact page, etc.) where the user initiates a call.
# 4. A framework scenario for obtaining device credentials
At present, the framework will obtain device credentials at the following times, and it is recommended to pre-pull them in advance:
- Weixin Mini Program Audio and video calling, using the VOIP calling plug-in, when calling initByCaller to initiate a call.
# 5. Switch from the device authentication SDK to registering devices using WMPF
If you previously used the device authentication SDK and want to switch to WMPF registration, you can pay attention to the following:
- Don't mix device certification SDK and WMPF registration devices on the same device
- APP can remove voipsdk-1.x-release.aar and safeguard-release.aar.
- For previously registered devices, the
registerMiniProgramDeviceinterface needs to be re-invoked to refresh the device key. - Developers no longer need to fetch and pass in deviceToken / callerTicket, and cannot pass voipToken parameters when using plug-ins.
- If the previous developer did the logic to get deviceToken / callerTicket in advance, it can be replaced by calling
prefetchDeviceTokenin advance.