All Products
Search
Document Center

SuperApp:MiniAppInitConfig.Builder

Last Updated:Jun 19, 2025

The Builder class of MiniAppInitConfig, which is used to construct MiniAppinitConfig.

public static class Builder

setAccessKey

public MiniAppInitConfig.Builder setAccessKey(String accessKey)

Sets an AccessKey.

Parameters

accessKey

String: the AccessKey, which can be obtained from Application Open Platform.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setSecretKey

public MiniAppInitConfig.Builder setSecretKey(String secret)

Sets a SecretKey.

Parameters

secretKey

String: the SecretKey, which can be obtained from Application Open Platform.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setUseUniApp

public MiniAppInitConfig.Builder setUseUniApp(boolean use)

Specifies whether to use the uni-app miniapp container. By default, the uni-app miniapp container is not used.

Parameters

use

Boolean: The valid values for this parameter are true and false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setUseWindVane

public MiniAppInitConfig.Builder setUseWindVane(boolean use)

Specifies whether to use the WindVane miniapp container. By default, the WindVane miniapp container is not used.

Parameters

use

Boolean: The valid values for this parameter are true and false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setAppCode

public MiniAppInitConfig.Builder setChannel(String appCode)

Sets an App Code.

Parameters

appCode

String: the app ID, which can be obtained from Application Open Platform.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setHost

public MiniAppInitConfig.Builder setHost(String host)

Sets a backend service host for a miniapp.

Parameters

host

String: the backend service host.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setUseHttp

public MiniAppInitConfig.Builder setUseHttp(boolean http)

Specifies whether to use HTTP or HTTPS. By default, HTTPS is used.

Parameters

http

Boolean: The valid values for this parameter are true and false. A value of true indicates that HTTP is used, and a value of false indicates that HTTPS is used.

Returns

MiniAppInitConfig.Builder

The Builder instance.

openLog

public MiniAppInitConfig.Builder openLog(boolean open)

Specifies whether to enable the logging feature. By default, the logging feature is disabled.

Parameters

open

Boolean: The valid values for this parameter are true and false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setCustomOAID

public MiniAppInitConfig.Builder setCustomOAID(String oaid)

Sets the Open Anonymous Device Identifier (OAID) to connect the account system of Alibaba Cloud to the account system of an app.

Parameters

oaid

String: the OAID used by the account system of the app.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setCapsule

public MiniAppInitConfig.Builder setCapsule(boolean isCapsule)

Specifies whether to use capsule buttons. By default, capsule buttons are used. This method is applicable only to uni-app miniapps.

Note

If navigationBar or titleNView is not configured in your uni-app miniapp, capsule buttons are not displayed.

Parameters

isCapsule

Boolean: The valid values for this parameter are true and false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setMenuDefFontColor

public MiniAppInitConfig.Builder setMenuDefFontColor(String menuDefFontColor)

Sets the default color of text on menu buttons. This method is applicable only to uni-app miniapps.

Parameters

menuDefFontColor

String: the font color. Valid values: strings in the #RRGGBB or rgba(R,G,B,A) format. Default value: #000000.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setMenuDefFontSize

public MiniAppInitConfig.Builder setMenuDefFontSize(String menuDefFontSize)

Sets the default font size of text on menu buttons. This method is applicable only to uni-app miniapps.

Parameters

menuDefFontSize

String: the font size of text on menu buttons. Valid values: strings in the "digits+px" format. Default value: 22px.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setMenuDefFontWeight

public MiniAppInitConfig.Builder setMenuDefFontWeight(String menuDefFontWeight)

Sets the default font weight of text on menu buttons. This method is applicable only to uni-app miniapps.

Parameters

menuDefFontWeight

String: the font weight of text on menu buttons. Valid values: normal and bold. Default value: normal.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setMenuActionSheetItems

public MiniAppInitConfig.Builder setMenuActionSheetItems(List<MiniAppMenuActionSheetItem> list)

Sets the default menu buttons. This method is applicable only to uni-app miniapps.

Parameters

list

List<MiniAppMenuActionSheetItem>: a list of default menu buttons. The setting takes effect only if setCapsule is set to true.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setEnableBackground

public MiniAppInitConfig.Builder setEnableBackground(boolean isEnableBackground)

Specifies whether a miniapp can run in the background after the miniapp is exited. This method is applicable only to uni-app miniapps.

Note

After you enable the run in background feature, the multitasking window appears. If you do not need a separate task window for the miniapp, disable the run in background feature. The run in background feature is coupled with the multitasking window feature .

Parameters

isEnableBackground

Boolean: The valid values for this parameter are true and false. Default value: false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setUniMPFromRecents

public MiniAppInitConfig.Builder setUniMPFromRecents(boolean isFromRecents)

Specifies whether to display a miniapp task window. This window is displayed only when the corresponding miniapp runs in the background. This method is applicable only to uni-app miniapps.

Parameters

isFromRecents

Boolean: The valid values for this parameter are true and false. The task window is displayed only when the miniapp runs in the background. Default value: true.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setCapsuleButtonStyle

public MiniAppInitConfig.Builder setCapsuleButtonStyle(MiniAppCapsuleButtonStyle style)

Sets the capsule button style. This method is applicable only to uni-app miniapps.

Parameters

style

MiniAppCapsuleButtonStyle: the capsule button style.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNJS

public MiniAppInitConfig.Builder setNJS(boolean enable)

Specifies whether to enable the NJS feature. By default, this feature is disabled. This method is applicable only to uni-app miniapps.

Parameters

enable

Boolean: The valid values for this parameter are true and false.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNavigationBarTransparent

public void setNavigationBarTransparent(boolean navigationBarTransparent)

Sets the transparency of the navigation bar background, a feature exclusive to WindVane mini-programs.

Parameters

navigationBarTransparent

boolean: Determines if the navigation bar background is transparent. By default, it is opaque. When set to transparent, the app defaults to full-screen mode and automatically hides the status bar under gesture navigation.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNavigationBarColorInt

public MiniAppInitConfig.Builder setNavigationBarColorInt(int colorInt)

Sets the color of the navigation bar background, a feature exclusive to WindVane mini-programs.

Parameters

colorInt

int: sets the background color of the navigation bar, with black as the default.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNavigationBarDarkIcon

public MiniAppInitConfig.Builder setNavigationBarDarkIcon(boolean darkIcon)

Sets the navigation bar icon to either a dark or light color, a feature exclusive to WindVane mini-programs.

Parameters

darkIcon

boolean: true for dark icons | false for light icons

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNavigationBarWithKitkatEnable

public MiniAppInitConfig.Builder setNavigationBarWithKitkatEnable(boolean navigationBarWithKitkatEnable)

Enables or disables modification of the navigation bar color on Android 4.4 devices, a feature exclusive to WindVane mini-programs.

Parameters

navigationBarWithKitkatEnable

boolean: Default is true.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setNavigationBarWithEMUI3Enable

public MiniAppInitConfig.Builder setNavigationBarWithEMUI3Enable(boolean navigationBarWithEMUI3Enable)

Enables or disables modification of the navigation bar color on EMUI 3.x devices, a feature exclusive to WindVane mini-programs.

Parameters

navigationBarWithEMUI3Enable

boolean: Default is true.

Returns

MiniAppInitConfig.Builder

The Builder instance.

setAppAuthPopStyle

public MiniAppInitConfig.Builder setAppAuthPopStyle(MiniAppAuthPopStyle appAuthPopStyle)

The pop-up window style when the mini program calls the device information related interface. Only supports windvane miniapp.

Parameters

MiniAppAuthPopStyle

Initialize the configuration class

Returns

MiniAppInitConfig.Builder

Builder Example.

setMiniAppFavoriteStyle

public MiniAppInitConfig.Builder setMiniAppFavoriteStyle(MiniAppFavoriteStyle miniAppFavoriteStyle)

Click More in the navigation bar to display the pop-up window Style. Only supports windvane miniapp.

Parameters

MiniAppFavoriteStyle

Initialize the configuration class

Returns

MiniAppInitConfig.Builder

Builder Example.

setNeedAuthFromApp

public MiniAppInitConfig.Builder setNeedAuthFromApp(boolean needAuthFromApp)

Whether to enable the user authorization when the mini program calls the device information related interface,(See also Authorization description),Only supports windvane miniapp.

Parameters

needAuthFromApp

boolean :true | false

Returns

MiniAppInitConfig.Builder

Builder Example.

setSuperNameSpace

public MiniAppInitConfig.Builder setSuperAppNameSpace(String superNameSpace)

Supports configurable mini app calling JsApi window object name. The default mini app call is "window.WindVane". The namespace of the mini app call can be modified. Only windvane mini app is supported.How to use the Mini App JsApi white label

Parameters

superAppNameSpace

String: Configurable JSAPI channel name

Returns

MiniAppInitConfig.Builder

Builder Example.

setJsApiClassNamePrefix

public MiniAppInitConfig.Builder setJsApiClassNamePrefix(String jsApiClassNamePrefix)

Supports namespace that can be modified for the miniapp jsapi method call. The default mini app call is window.WindVane. This parameter is applicable only to windvane miniapps.How to use the Mini App JsApi white label

Parameters

jsApiClassNamePrefix

String: Configurable JSAPI prefix

Returns

MiniAppInitConfig.Builder

Builder Example.

setWindVaneBackwardCompatible

public MiniAppInitConfig.Builder setWindVaneBackwardCompatible(boolean isWindVaneBackwardCompatible) 

Whether window.WindVane.call can be used to call jsapi methods. The default value is true.This parameter is applicable only to windvane miniapps.How to use the Mini App JsApi white label

Parameters

isWindVaneBackwardCompatible

boolean:false Not supported | true supported

Returns

MiniAppInitConfig.Builder

Builder Example.

build

public MiniAppInitConfig build()

Builds MiniAppInitConfig based on configurations.

Returns

MiniAppInitConfig

The initialization configurations of the miniapp container.