Skip to content

Applet Information Management

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

1.Search for applets

To search for the applet, 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 applets

API

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

SearchAppletRequest Description.

kotlin
/**
* :: Search for applet 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 applet return entity classes
*
* @param list A collection of searched applets
* @param total Number of applets searched
*/
data class SearchAppletResponse(
 val list: List<AppletInfo>? ,
 val total: Int
)

/**
* The applet information entity class returned by the search applet
*
* @param appId applet id
* @param appName applet name
* @param desc applet description information
* @param highLights highlight font
* @param logo applet logo
* @param organName Business name
* @param pageUrl Path to the page searched by the applet
* @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 #### :::: tabs ::: tab "Kotlin"

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?) {
 }
 })

:::

::: tab "Java"

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 applet object information

API

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

Example of a call to #### :::: tabs ::: tab "Kotlin"

kotlin
val appInfo = FinAppClient.appletApiManager.getAppletInfo("appId")

:::

::: tab "Java"

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

::: ::::

Field NameDescription
appIdapplet id
codeIdapplet code package ID
userIdapplet developer id
appAvatarApplet avatar
appTitleapplet title
appDescriptionapplet description
appPathapplet path
appVersionapplet version number
appVersionDescriptionApplet version description
sequenceapplet sequence
isGrayVersionisGrayVersion
appThumbnailapplet thumbnail
groupIdOrganization ID
groupNameName of organization to which you belong
appTypeapplet type
createdByapplet developers
createdTimeapplet creation time
startParamsstartParams
infoExtended information
fromAppIdthe applet's source applet id
If applet A opens applet B by calling navigateToMiniProgram, then for applet B, fromAppId is the appId of applet A
finStoreConfigApplet Marketplace Configuration Information
frameworkVersionBase library version number
urlapplet download address
md5Small Packet MD5
cryptInfoApplet Encryption Information

3.Get the applet'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 applet page

API

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

Example of a call to #### :::: tabs ::: tab "Kotlin"

kotlin
FinAppClient.appletApiManager.captureAppletPicture(
 "appId",
 object : FinCallback<Bitmap?> {
 override fun onSuccess(result: Bitmap?) {
 Log.d(TAG, "Get screenshot of applet page successfully :
$result")
 }
 override fun onError(code: Int, error: String?) {
 Log.e(TAG, "Failed to get screenshot of applet page :
$code, $error")
 }
 override fun onProgress(status: Int, info: String?) {
 }
 })

:::

::: tab "Java"

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

::: ::::

5.Get used applets

5.1 Get the used specified applet

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

Example of a call to ##### :::: tabs ::: tab "Kotlin"

kotlin
val finApplet = FinAppClient.appletApiManager.getUsedApplet("appId")

:::

::: tab "Java"

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

::: ::::

5.2 Getting a list of used applets

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

Example of a call to ##### :::: tabs ::: tab "Kotlin"

kotlin
val usedApplets = FinAppClient.appletApiManager.getUsedApplets()

:::

::: tab "Java"

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

::: ::::

5.3 Determining whether an applet is used

API

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

Example of a call to #### :::: tabs ::: tab "Kotlin"

kotlin
val isUsedApplet = FinAppClient.appletApiManager.isUsedApplet("appId")

:::

::: tab "Java"

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

::: ::::

6.Get the id of the current applet

API

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

Example of a call to #### :::: tabs ::: tab "Kotlin"

kotlin
val currentAppletId =
FinAppClient.appletApiManager.getCurrentAppletId()

:::

::: tab "Java"

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

::: ::::

7.Convert Phiz applet QR code information to PhizClip applet

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

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

API

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

The structure of ParsedAppletInfo is as follows.

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

Example of a call to #### :::: tabs ::: tab "Kotlin"

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")
 }
 })

:::

::: tab "Java"

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);
 }
 }
);

::: ::::