Mini Program Version Types
There are four types of Mini Program versions:
Official Version: This version is available for public use. Anyone can access it by scanning the QR code.
Development Version: This is the version used for development and debugging.
Preview Version: This is the version for preview and examination.
Experience Version: This is the beta testing version.
Open the Mini Program
Upon opening the Mini Program, the system first checks whether there is a cached version of the Mini Program locally. If not, it will automatically download the Mini Program from the remote server and then launch it. If a cached version exists, the local Mini Program will be launched first, while the backend simultaneously verifies whether a newer version exists on the server.
Note:
Should a newer version be available, the system will download the updated Mini Program. Consequently, the next time the Mini Program is launched, the updated version will be utilized.
public static void startMiniApp(Activity activity, String appId, MiniStartOptions options)
public static void startMiniApp(Activity activity, String appId, int scene, int appVerType, MiniStartOptions options) {
Launching the Official Version of the Mini Program
The following method is used to launch the latest online version of the Mini Program.
TmfMiniSDK.startMiniApp(this, appId, options);
Launching the Preview and Development Versions of the Official Mini Program
If preview/development version information already exists locally (as indicated by the getRecentList returning a list of existing Mini Programs), this method can be used to launch it. Otherwise, use the QR code scanning feature of startMiniAppByLink to launch it.
Note:
Set the appVerType parameter in the startMiniApp method.
TmfMiniSDK.startMiniApp(this, appId, MiniScene.LAUNCH_SCENE_MAIN_ENTRY, appVerType, options);
Opening the Mini Program from Search Results
Open the Mini Program from the list returned by searching the TmfMiniSDK.searchMiniApp interface.
TmfMiniSDK.startMiniApp(this, appId, MiniScene.LAUNCH_SCENE_SEARCH, MiniApp.TYPE_ONLINE, options);
The miniStartOptions.resultReceiver can be used to receive error messages when launching the Mini Program. Therefore, the returned error codes can be referenced in MiniCode, which provides corresponding explanations. private ResultReceiver mResultReceiver = new ResultReceiver(new Handler()) {
@Override
protected void onReceiveResult(int resultCode, Bundle resultData) {
if (resultCode != MiniCode.CODE_OK) {
String errMsg = resultData.getString("errMsg");
Toast.makeText(mActivity, errMsg + resultCode, Toast.LENGTH_SHORT).show();
}
}
};
Launch the Mini Program via QR Code.
TMF incorporates a built-in scanning module, which is initiated through the scan interface. The scan results are processed in onActivityResult by calling the scanResult.
public static void scan(Activity activity)
public static JSONObject getScanResult(int requestCode, Intent intent)
public static void startMiniAppByLink(Activity activity, String link,
MiniStartLinkOptions resultReceiver)
Was this page helpful?