WeChat Mini Program Framework(WMPF) Introduce

What’s WeChat Mini Program Framework (WMPF)

WeChat Mini Program Framework

1. Product summary

The Wechat Mini-Program Framework, or WMPF for short, is an operating environment that allows the hardware to run WeChat applets in an environment that is separate from the WeChat client, and currently supports Android devices.

2. Product capabilities

The WeChat applet running on WMPF is the same as the WeChat applet of the mobile client. Through WMPF, developers can enable WeChat platform capabilities to hardware devices. For details, please refer to the “Beta Beta Capability List” at the end of the article.

3. Product advantages

For hardware developers:

  • Low development costs: Developers no longer need to invest in high costs to develop or maintain updates to the App, and small programs can be updated online, that is, more ready to use.
  • Rich content ecology: WeChat mini-program ecology has a wealth of content services. The hardware can directly run the mini-program content on the existing network to provide users with comprehensive services.

For mini-program developers:

  • Cross-terminal operation: Only one development is required to achieve the multi-terminal operation of small programs, and the adaptation cost is low.
  • Expand offline scenes: Mini-programs get more traffic from offline scenes and draw users online through offline scenes.

4. The use of scenarios

The WMPF applet hardware framework can be applied to hardware such as Android system tablet computers and large screen devices in various industries, providing low-cost screen interactive solutions. Accessible devices include, but are not limited to:

  • Smart retail: cash register / numbering machine / shopping mall navigation screen / vending machine / order tablet / interactive advertising screen, etc …
  • Home and Entertainment Equipment: Smart Refrigerator / Children’s Tablet / Treadmill / TV / KTV Jukebox, etc …
  • Public services: hospital registration machine / book rental equipment / gallery card machine, etc.
  • Office equipment: education tablet / conference terminal / conference projection screen, etc …

5. Access Application

  • Step 1: Register for an account at https://wecooper.weixin.qq.com To register an account, please prepare a business license for uploading in advance.
  • Step 2: Experience the product Enter “WeChat Mini Program Hardware Framework-Product Usage Guide” Download and test the demo, install the demo on an Android device, and then experience the WMPF ability in your hardware device.
  • Step 3: If the activation function needs to be used formally, please click “Apply for activation”. After the approval, you can bind the small program that needs to be officially run on the hardware.
  • Step 4: Register the device

Only devices authenticated by the platform can run WMPF.

① Add device-Please add the device type of the hardware framework of the applet you want to go online in “Home-Device Management”.

② Add a model-Add a specific model, and select “Wechat Mini Program Hardware Framework” in the “Access Business Module” item.

③ Register interface-After adding devices and models, you need to configure the public ID AppID in the “Home-Upload Interface”, register the background interface and upload the device ID, and see how to register the deviceId interface .

  • Step 5: Development and Implementation Through the following development guidelines in this document, the ability of LauncherAPP to call WMPF is realized.
  • Step 6: After completing the development of the bound applet, you need to enter the mobile application AppID (ie, AppID of LauncherAPP) on the “WeChat Mini Program Hardware Framework-Applet Management” page to bind the applet to be run by the hardware device. See how to bind applets

6.  Development guidelines

Step 1: Run the applet on the target device

According to the APK file provided in the “WeChat Mini Program Hardware Framework”, the developer needs to install the APK to an Android system device. After the installation is successful, the “WeChat Mini Program Hardware Framework” (WMPF) will be applied to the hardware device. The application contains the environment needed by the applet to run and can respond to requests to start the applet. This application is called WMPF Service.

Merchants need to write an application that sends requests. This application is called WMPF Client.

These two parts are all installed in the same device and communicate through our defined Task. A Task can be understood as an API that defines a certain service, such as IPCInvokerTask_ActivateDevice for activating the device and IPCInvokerTask_LaunchWxaApp for starting the applet.

It takes at least four steps to run an applet

① Register the hardware.

② Call IPCInvokerTask_ActivateDevice to activate the device.

③ Call IPCInvokerTask_Authorize to log in.

④ Call IPCInvokerTask_LaunchWxaApp to start the applet.

  1. Send device activation request IPCInvokerTask_ActivateDevice:

Note: Get the process and the way ProductId, keyVersion, deviceId and signature Please see registration process hardwareIn order to ensure that the device is legal, you can run the applet when you are not logged in.

The code example is as follows:

WMPFActivateDeviceRequest request = new WMPFActivateDeviceRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
request.productId = 1
request.keyVersion = 2
request.deviceId = "Your DEVICE ID"
request.signature = "Your SIGNATURE"
WMPFIPCInvoker.invokeAsync(
    request,
    IPCInvokerTask_ActivateDevice.class,
    new IPCInvokeCallback<WMPFActivateDeviceResponse>() {
        @Override
        public void onCallback(WMPFActivateDeviceResponse response) {
            // process result
        
    }
);
  1. Send an authorization request to IPCInvokerTask_AuthorizeNoLogin or IPCInvokerTask_Authorize:

Note: For the acquisition process and method of DeviceTicket and Ticket, see the sample code OpenSdkTestUtil.java in WMPF Client Demo

The code example is as follows:

WMPFAuthorizeNoLoginRequest request = new WMPFAuthorizeNoLoginRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
request.ticket = "Your SDK Ticket"
request.appId = "Your AppId"
request.scope = "snsapi_userinfo,snsapi_runtime_apk"
WMPFIPCInvoker.invokeAsync(
    request,
    IPCInvokerTask_AuthorizeNoLogin.class,
    new IPCInvokeCallback<WMPFAuthorizeNoLoginResponse>() {
        @Override
        public void onCallback(WMPFAuthorizeNoLoginResponse response) {
            // process result
        }
    }
);
WMPFAuthorizeRequest request = WMPFAuthorizeRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
request.ticket = ticket
request.appId = appId // OpenSDK AppId for App
request.scope = "snsapi_userinfo,snsapi_runtime_apk"
WMPFIPCInvoker.invokeAsync(
    request,
    IPCInvokerTask_Authorize.class,
    new IPCInvokeCallback<WMPFAuthorizeResponse>() {
        @Override
        public void onCallback(WMPFAuthorizeResponse response) {
            // process result
        }
    }
);
  1. Send the launch applet request IPCInvokerTask_LaunchWxaApp:

Note: it can only be called successfully if the device is successfully activated

The code example is as follows:

WMPFLaunchWxaAppRequest request = new WMPFLaunchWxaAppRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()
request.appId = "Your AppId"
request.path = "Target Wxa Path"
request.isNoLogin = true

WMPFIPCInvoker.invokeAsync(
    request,
    IPCInvokerTask_LaunchWxaApp.class,
    new IPCInvokeCallback<WMPFLaunchWxaAppResponse>() {
        @Override
        public void onCallback(WMPFLaunchWxaAppResponse response) {
            // process result
        }
    }
);
  1. When you do not need to run the applet, you can send a deauthorization request: IPCInvokerTask_Deauthorize:

The code example is as follows:

WMPFDeauthorizeRequest request = new WMPFDeauthorizeRequest()
request.baseRequest = WMPFBaseRequestHelper.checked()

WMPFIPCInvoker.invokeAsync(
    request,
    IPCInvokerTask_Deauthorize.class,
    new IPCInvokeCallback<WMPFDeauthorizeResponse>() {
        @Override
        public void onCallback(WMPFDeauthorizeResponse response) {
            // process result
        }
    }
);

To quickly experience the process of launching the applet, you can install the sample DEMO provided in the attachment and run the applet. However, in a formal environment, you need to write the application that sends the request according to the above process (you can customize the interaction and interface to start the applet as required). For specific implementation, see the code of the sample DEMO.

Step 2: Run the applet on the target device

  • The API in the applet hardware framework is the same as the input and output in the WeChat client, and you can use it as described in the applet’s documentation. Some APIs may not be supported yet, such as code scanning / multi-threading. For specific support capabilities, please refer to the appendix “Beta Beta” Edition capability list》
  • The development tools are the same as WeChat developer tools.

Step 3: Run the applet on the target device How to debug the applet on the hardware device

  • After installing WeChat developer tools, open the project or modify the code, click “Preview” to upload the local code to the WeChat background server to generate a QR code. Developers can send real-time debugging by requesting IPCInvokerTask_LaunchWxaAppByQrCode on the hardware device.
  • Specific implementation can refer to the sample DEMO code-remote debugging:

Click for more detailed development guidelines

7. Contact information

We sincerely invite developers to access the applet hardware framework project. For more latest developments, welcome to follow the following public accounts:

For more cooperation information, please contact wecooper@tencent.com

8. WeChat Mini Program Hardware Framework-Beta Beta Capability List

Module category Specific interface / component wmpf support Note
Mini Program Interface Media Video playback (full screen / non-full screen), recording
Audio playback, recording
Picture read, save local, upload locally
Audio background playback (current applet is not running in the foreground)
File read, save locally, upload locally
Embedded web-view page Coming soon
Mini Program VoIP Coming soon
Show vertical applet in the center in landscape Coming soon
Recalling information stored on the local device Via local interface
Message class Template message pops up on mobile phone (small program one-time subscription)
Enter the customer service message by scanning the code on the mobile phone Does not support iOS mobile phone scan code
Message push capability (unconditionally limited, but applets started at least once a month) WMPF-specific capabilities The style is specified by the partner
Location class Get current location information
View location
Account category Mobile phone code scan login
Scan the code on your mobile phone and share it with your WeChat friends
Scan and complete login and payment in one scan not support
Scan the code to complete the app WeChat login and framework login status
Get phone number
Get address information
Hardware Bluetooth
Get system information
Get system SN code WMPF-specific capabilities
Get network status
compass
WiFi
NFC Hce capability as shown in the documentation
printer WMPF-specific capabilities
Non-standard camera (fixed focus, industrial) WMPF-specific capabilities
WiFi speakers tts WMPF-specific capabilities
Camera components
Payment When there is a WeChat client, pull the client to pay
When there is no WeChat client, the mobile client scans the code to pay WMPF-specific capabilities Only supports the same uin
Add coupons and membership cards in the applet Scan code via mobile phone
3D face registration and payment Coming soon
Operation and Maintenance Debug interface
Transfer authentication information to complete device registration WMPF-specific capabilities
Binding with the main applet WMPF-specific capabilities
The partner can decide whether the applet appears on the mobile phone synchronously WMPF-specific capabilities
Monitoring data reporting WMPF-specific capabilities
CLI experience version development kit tools WMPF-specific capabilities
Configurable Disable Capsule Close Button WMPF-specific capabilities
Configurable menu items (add / remove) Coming soon
Jump class Mini Program Jump Mini Program (no confirmation prompt, unlimited times) WMPF-specific capabilities
Applet jump app WMPF-specific capabilities
Generate small program code with parameters
Applet menu with back to home and restart applet buttons WMPF-specific capabilities
Can be monitored through the interface when the applet exits WMPF-specific capabilities
Applet component View container
Basic content: icon, text, etc.
Form components: buttons, checkboxes, etc.
navigation
Media components
map
canvas
Applet full screen display (system navigation bar is not displayed)
Applet hardware framework Sub-package loading
Preloading
Applet running in the background, background management (Android system)
Hot Patch Verification
other Trial version applet
CLI experience version development kit tools
Hardware running score tool Coming soon