# Launching Offline Mini-Programs

This interface is used to launch purely offline Mini-Programs. It is a restricted API and requires an SDK key and secret with offline functionality enabled to be used.

Launching an offline Mini-Program requires the offline Mini-Program package and the Mini-Program Base Library information. These can be obtained by exporting the offline package from the Developer Tools. Simply pass the path of the exported offline package when using the interface.

The Base Library needs to be provided separately by FinClip.

# 1 Launching Offline Mini-Programs

Interface Description:

/**
 * Launch a local Mini-Program
 * @param appId Mini-Program id
 * @param appTitle Mini-Program name
 * @param appAvatar Mini-Program logo
 * @param appRuntimeDomain Mini-Program domain list
 * @param packages Mini-Program subpackage information
 * @param frameworkPath Base Library path
 * @param frameworkUseCache Whether to use the cached Base Library; if false, it will be re-extracted each time
 * @param appletPath Mini-Program path
 * @param appletPassword Mini-Program compressed package password
 * @param appletUseCache Whether to use the cached Mini-Program
 *
 */
fun startLocalApplet(context: Context,
                     appId: String, appTitle: String?, appAvatar: String?,
                     appRuntimeDomain: AppRuntimeDomain?, packages: List<Package>?,
                     startParams: FinAppInfo.StartParams?,
                     frameworkPath: String, frameworkUseCache: Boolean,
                     appletPath: String, appletPassword: String, appletUseCache: Boolean
)

Usage Example:

val appletPath = "$filesDir/miniprogram.zip"
val packages: List<Package> = Gson().fromJson(File("$filesDir/packageConfig.json").readText(), object : TypeToken<List<Package>>() {}.type)
val frameworkPath = "$filesDir/mop-framework-2.12.7.zip"
FinAppClient.appletApiManager.startLocalApplet(this, "6177b98f95604100015ea8d1", "Scenario Two Mini-Program Modified Name", null, null, packages,
        FinAppInfo.StartParams("/pages/me/me",""), frameworkPath, false, appletPath, "", false)

The above calling interface has been marked as deprecated since version 2.37.5. It is replaced by the following method to launch an offline Mini-Program:

FinAppClient.appletApiManager.startApplet(this,
    IFinAppletRequest.fromLocal("6177b98f95604100015ea8d1", null,
        "Scenario Two Mini-Program Modified Name", null, null, frameworkPath)
        .packages(packages)
        .appRuntimeDomain(null)
        .applet(appletPath, "", false)
        .extApiWhiteList(null)
)

# 1.1 Setting the Mini-Program Version Identifier

By default, the version identifier for an offline Mini-Program is Release. You can customize the version identifier at launch:

request.setAppletVersionType(FinAppletType.APPLET_TYPE_RELEASE)

Available options are as follows:

  • FinAppletType.APPLET_TYPE_TRIAL

    Trial Version

  • FinAppletType.APPLET_TYPE_TEMPORARY

    Temporary Version

  • FinAppletType.APPLET_TYPE_REMOTE_DEBUG

    Online Debug Version

  • FinAppletType.APPLET_TYPE_REVIEW

    Review Version

  • FinAppletType.APPLET_TYPE_RELEASE

    Release Version (Default)

  • FinAppletType.APPLET_TYPE_DEVELOPMENT

    Development Version

© FinClip with ❤ , Since 2017