Skip to content

Mini Program Information Management

This module is mainly to get some Api introduction for mini program information.

1.Search for mini program

To search for the mini program, two steps are required.

  1. ensure that this server information is configured when the SDK is initialised.
  2. call this search interface to search for mini program

API

kotlin
/**
* :: Search for mini program
*
* @param searchAppletRequest request body
* @param callback Request result callback
*/
fun searchApplet(
 searchAppletRequest: SearchAppletRequest,
 callback: FinCallback<SearchAppletResponse>
)

SearchAppletRequest Description.

kotlin
/**
* :: Search for mini program request entity classes
*
* @param apiServer Server address
* @param text Search content
*/
data class SearchAppletRequest(var apiServer: String,
var text: String)

SearchAppletResponse Description.

kotlin
/**
Subscribe to DeepL Pro to edit this document.
Visit www.DeepL.com/profor more information.
* :: Search for mini program return entity classes
*
* @param list A collection of searched mini program
* @param total Number of mini program searched
*/
data class SearchAppletResponse(
 val list: List<AppletInfo>? ,
 val total: Int
)

/**
* The mini program information entity class returned by the search mini program
*
* @param appId mini program id
* @param appName mini program name
* @param desc mini program description information
* @param highLights highlight font
* @param logo mini program logo
* @param organName Business name
* @param pageUrl Path to the page searched by the mini program
* @param showText Show content
*/
data class AppletInfo(
 val appId: String?
 val appName: String?
 val desc: String?
 val highLights: List<HighLight>? ,
 val logo: String?
 val organName: String?
 val pageUrl: String?
 val showText: String?
)

/**
* Highlighted fonts
*
* @param key key of the highlighted font
* @param value value of the highlighted font
*/
data class HighLight(
 val key: String?
 val value: String?
)

Example of a call to ####

kotlin
FinAppClient.appletApiManager.searchApplet(
 SearchAppletRequest("ServiceLocationAddress", "SearchContent"),
 object : FinCallback<SearchAppletResponse> {
 override fun onSuccess(result: SearchAppletResponse?) {
 // Search successful
 }

 override fun onError(code: Int, error: String?) {
 // Search failed
 }
 override fun onProgress(status: Int, info: String?) {
 }
 })
java
FinAppClient.INSTANCE.getAppletApiManager().searchApplet(
 new SearchAppletRequest("ServerAddress", "SearchContent"),
 new FinCallback< SearchAppletResponse>() {
 @Override
 public void onSuccess(SearchAppletResponse result) {
 // Search successful
 }
 @Override
 public void onError(int code, String error) {
 // Search failed
 }
 @Override
 public void onProgress(int status, String info) {
 }
 });

2.Get mini program object information

API

kotlin
/**
* Get information about the mini program
*/
fun getAppletInfo(appId: String): FinAppInfo?

Example of a call to ####

kotlin
val appInfo = FinAppClient.appletApiManager.getAppletInfo("appId")
java
FinAppInfo appInfo = FinAppClient.INSTANCE.getAppletApiManager().getAppletInfo("appId");

| Field Name | Description | | ------------------------------------------------------------ | ------------------------------------------------------------------------ | ------------- | | ------------------------------------------------------------ | | appId | mini program id | | codeId | mini program code package ID | | userId | mini program developer id | | appAvatar | mini program avatar | | appTitle | mini program title | | appDescription | mini program description | | appPath | mini program path | | appVersion | mini program version number | | appVersionDescription | mini program version description | | sequence | mini program sequence | | isGrayVersion | isGrayVersion | isGrayVersion | | appThumbnail | mini program thumbnail | | groupId | Organization ID | | groupName | Name of organization to which you belong | | appType | mini program type | | createdBy | mini program developers | | createdTime | mini program creation time | | startParams | startParams | | info | Extended information | | fromAppId | the mini program's source mini program id< br /> If mini program A opens |

mini program B by calling navigateToMiniProgram, then for mini program B, fromAppId is the appId of mini program A | | finStoreConfig | mini program Marketplace Configuration Information | | frameworkVersion | Base library version number | | url | mini program download address | | md5 | Small Packet MD5 | | cryptInfo | mini program Encryption Information |

3.Get the mini program's current WebView information

3.1 Get the URL of the current webView

The URL corresponding to the H5 will only be returned if the current page is loading an H5.

kotlin
FinAppClient.appletApiManager.getCurrentWebViewURL(
 object : FinCallback<String> {
 override fun onSuccess(result: String?) {
 toast("url:$result")
 }
 override fun onError(code: Int, error: String?) {
 }
 override fun onProgress(status: Int, info: String?) {
 }
 })

3.2 Get the UserAgent of the current webView

kotlin
FinAppClient.appletApiManager.getCurrentWebViewUserAgent(
 object : FinCallback<String> {
 override fun onSuccess(result: String?) {
 toast("userAgent:$result")
 }
 override fun onError(code: Int, error: String?) {
 }
 override fun onProgress(status: Int, info: String?) {
 }
 })

4.Get a screenshot of the mini program page

API

kotlin
/**
* Get a screenshot of the mini program page
*
* @param appId mini program id
* @param callback mini program page screenshot callback
*/
fun captureAppletPicture(appId: String, callback: FinCallback<Bitmap?>)

Example of a call to ####

kotlin
FinAppClient.appletApiManager.captureAppletPicture(
 "appId",
 object : FinCallback<Bitmap?> {
 override fun onSuccess(result: Bitmap?) {
 Log.d(TAG, "Get screenshot of mini program page successfully :
$result")
 }
 override fun onError(code: Int, error: String?) {
 Log.e(TAG, "Failed to get screenshot of mini program page :
$code, $error")
 }
 override fun onProgress(status: Int, info: String?) {
 }
 })
java
FinAppClient.INSTANCE.getAppletApiManager().captureAppletPicture(
 "appId",
 new FinCallback< Bitmap>() {
 @Override
 public void onSuccess(Bitmap result) {
 Log.d(TAG, "Get screenshot of mini program page
successfully:" + bitmap);
 }
 @Override
 public void onError(int code, String error) {
 Log.e(TAG, "Failed to get screenshot of mini program page: "
+ code + ", " + error);
 }
 @Override
 public void onProgress(int status, String info) {
 }
 });

5.Get used mini program

5.1 Get the used specified mini program

API
kotlin
/**
* Get the used mini program for the specified mini program id
*
* @param appId mini program id
*/
fun getUsedApplet(appId: String): FinApplet?

Example of a call to #####

kotlin
val finApplet = FinAppClient.appletApiManager.getUsedApplet("appId")
java
FinApplet finApplet = FinAppClient.INSTANCE.getAppletApiManager().
getUsedApplet("appId");

5.2 Getting a list of used mini program

API
kotlin
/**
* Get all used mini program
*/
fun getUsedApplets(): List<FinApplet>

Example of a call to #####

kotlin
val usedApplets = FinAppClient.appletApiManager.getUsedApplets()
java
List< FinApplet> usedApplets = FinAppClient.INSTANCE.getAppletApiManager().getUsedApplets();

5.3 Determining whether an mini program is used

API

kotlin
/**
* :: Determine if it is a used mini program
*/
fun isUsedApplet(appId: String): Boolean

Example of a call to ####

kotlin
val isUsedApplet = FinAppClient.appletApiManager.isUsedApplet("appId")
java
boolean isUsedApplet = FinAppClient.INSTANCE.getAppletApiManager().isUsedApplet("appId");

6.Get the id of the current mini program

API

kotlin
/**
* Get the id of the current mini program
*/
fun getCurrentAppletId(): String?

Example of a call to ####

kotlin
val currentAppletId = FinAppClient.appletApiManager.getCurrentAppletId()
java
String currentAppletId = FinAppClient.INSTANCE.getAppletApiManager().getCurrentAppletId();

7.Convert WeChat mini program QR code information to FinClip mini program

The use scenario of this API is that when an mini program is on both WeChat and FinClip services, it can be associated with a WeChat mini program on the FinClip platform.The online version of the QR code on the FinClip platform can then be opened either by scanning the code with WeChat or by scanning the code with the FinClip Assistant or other APPs that have integrated the FinClip mini program SDK.

The process is to first scan the QR code, get the QR code content, then call the interface to get the FinClip mini program id, and finally call the API to open the mini program.

API

kotlin
/**
* Parsing mini program information based on WeChat QrCode information
*
* @param qrCode QR code information
* @param apiServer The server address of the application marketplace
where the mini program is hosted
* @param callback Result callback
*/
fun parseAppletInfoFromWXQrCode(
 qrCode: String,
 apiServer: String,
 callback: FinSimpleCallback<ParsedAppletInfo?>
)

The structure of ParsedAppletInfo is as follows.

kotlin
/**
* The mini program information entity class returned by parsing mini program
information based on WeChat QrCode information
*
* @param appId mini program id
*/
data class ParsedAppletInfo(
 val appId: String?
)

Example of a call to ####

kotlin
FinAppClient.appletApiManager.parseAppletInfoFromWXQrCode(
 qrCode,
 apiServer,
 object : FinSimpleCallback<ParsedAppletInfo?>() {
 override fun onSuccess(result: ParsedAppletInfo?) {
 Log.d(TAG, "parse onSuccess result : ${result.toString()}")
 }
 override fun onError(code: Int, error: String?) {
 Log.d(TAG, "parse onError code : $code, error : $error")
 }
 })
java
FinAppClient.INSTANCE.getAppletApiManager().
parseAppletInfoFromWXQrCode(
 qrCode,
 apiServer,
 new FinSimpleCallback< ParsedAppletInfo>() {
 @Override
 public void onSuccess(ParsedAppletInfo result) {
 Log.d(TAG, "parse onSuccess result : " + result.toString());
 }
 @Override
 public void onError(int code, @org.jetbrains.annotations.
Nullable String error) {
 Log.d(TAG, "parse onError code : " + code + ", error :" + error);
 }
 }
);