tencent cloud

API Description
Last updated: 2025-08-20 17:48:01
API Description
Last updated: 2025-08-20 17:48:01

MiniStartOptions

Configuration options for launching a mini program
/**
* Whether to force update when opening the mini program (effective for cold startup). false: Prioritizes using local cache while asynchronously fetching the latest data. true: Opens the mini program only after receiving a network response.
*/
public boolean isForceUpdate = false;
/**
* Entry address, supports adding parameters: path?key=value&key1=value1
*/
public String entryPath;
/**
* Receives error messages during the mini program launch process
*/
public ResultReceiver resultReceiver;

/**
* Mini program launch parameters
*/
public String params;

/**
* Sets the task mode to be used when opening the mini program
*
* false: Multi-task mode; true: Single-task mode
*/
public boolean isSingleTask;

MiniCode

Error code descriptions.
/**
* Success
*/
public static final int CODE_OK = 0;

////////////////////////////// Server error //////////////////////////////////
public static final int C_SERVER = -11000;
/**
* Shark network error
*/
public static final int C_SERVER_SHARK_ERROR = -11001;
/**
* Server returned an error code
*/
public static final int C_SERVER_RET_CODE_ERROR = -11002;
/**
* Server response is null
*/
public static final int C_SERVER_RESPONSE_NULL = -11003;
/**
* Server returned an invalid mini program update type
*/
public static final int C_SERVER_UPDATE_TYPE_ERROR = -11004;
/**
* Server data parsing exception
*/
public static final int C_SERVER_PARSE_DATA_ERROR = -11005;
/**
* The mini program does not exist or has been removed
*/
public static final int C_SERVER_TAKE_OFF = -11006;
/**
* Monthly active user limit reached
*/
public static final int C_SERVER_MAU_LIMIT = -11007;
/**
* Resource limit reached
*/
public static final int C_SERVER_RES_LIMIT = -11008;
/**
* Single API request frequency too high
*/
public static final int C_SERVER_FREQ_LIMIT_API = -11011;
/**
* Total request frequency too high
*/
public static final int C_SERVER_FREQ_LIMIT_TOTAL = -11012;
/**
* The QR code has expired
*/
public static final int C_SERVER_SCAN_CODE_EXPIRED = -11013;

////////////////////////////// Client error //////////////////////////////////
public static final int C_CLIENT = -12000;
/**
* The Shark instance is null
*/
public static final int C_CLIENT_SHARK_IS_NULL = -12001;
/**
* Previewing the mini program requires login first
*/
public static final int C_CLIENT_NEED_LOGIN_PREVIEW_APP = -12002;
/**
* Data parsing exception
*/
public static final int C_CLIENT_JSON_EXCEPTION = -12003;
/**
* Mini program information is missing
*/
public static final int C_CLIENT_MINI_APP_INFO_ERROR = -12005;
/**
* QR code error
*/
public static final int C_CLIENT_QRCODE_ERROR = -12006;
/**
* Invalid mini program QR code
*/
public static final int C_CLIENT_QRCODE_INVALIDATE = -12007;
/**
* The appid is empty
*/
public static final int C_CLIENT_APPID_EMPTY = -12008;
/**
* businessId null
*/
public static final int C_CLIENT_QRCODE_BUSINESSID_NULL = -12009;
/**
* Mini program launch exception
*/
public static final int C_CLIENT_START_MINI_APP_THROWABLE = -12010;
/**
* JSON parsing error
*/
public static final int C_CLIENT_JSON_ERROR = -12011;
/**
* Mini program download failed
*/
public static final int C_CLIENT_MINI_APP_DOWNLOAD_FAIL = -12012;
/**
* Mini program parsing failed
*/
public static final int C_CLIENT_MINI_APP_PARSE_FAIL = -12013;
/**
* MBEngine not integrated, game not supported
*/
public static final int C_CLIENT_MINI_GAME_MBENGINE_LOAD_FAIL = -12100;
/**
* Mini game disabled by server
*/
public static final int C_CLIENT_MINI_GAME_DISABLED = -12101;
/**
* Mini game base library load failed
*/
public static final int C_CLIENT_MINI_APP_BASE_LIB_LOAD_FAIL = -12103;
/**
* The game.js or the specified entry file does not exist
*/
public static final int C_CLIENT_MINI_GAME_ENTRY_ERROR = -12104;

MiniApp

Mini program information.

/**
* Mini program version: Released
*/
public static final int TYPE_ONLINE = MiniSDKConst.ONLINE;
/**
* Mini program version: Development
*/
public static final int TYPE_DEVELOP = MiniSDKConst.DEVELOP;
/**
* Mini program version: Preview
*/
public static final int TYPE_PREVIEW = MiniSDKConst.PREVIEW;
/**
* Mini program appid
*/
public String appId;
/**
* Mini program version (released/preview/development)
*/
public int appVerType;
/**
* Mini program version
*/
public String version;
/**
* Mini program name
*/
public String name;
/**
* Mini program icon
*/
public String iconUrl;
/**
* Mini program introduction
*/
public String appIntro;
/**
* Developer's company name
*/
public String appDeveloper;
/**
* Timestamp
*/
public long time;
/**
* Mini program engine type:
* MiniEngineType.MiniApp: Mini program
* MiniEngineType.MiniGame: Mini game
*/
public MiniEngineType engineType;

MiniScene

The scene in which the mini program is opened.
/**
* Main entry point of the mini program, from the "Recently used" list
*/
public static final int LAUNCH_SCENE_MAIN_ENTRY = 1001;
/**
* Opened via QR code scan
*/
public static final int LAUNCH_SCENE_QR_CODE_FROM_SCAN = 1011;
/**
* Opened via search
*/
public static final int LAUNCH_SCENE_SEARCH = 2005;

SearchOptions

/**
* Search keyword; if empty, searches all mini programs
*/
public String keyWord = "";
/**
* Specifies the first-level category
*/
public String firstLevelCate;
/**
* Specifies the second-level category
*/
public String secondaryLevelCate;
/**
* Specifies the engine type:
* 1. MiniEngineType.MiniApp: Searches mini programs only
* 2. MiniEngineType.MiniGame: Searches mini games only
* 3. If not specified, searches both mini programs and mini games
*/
public MiniEngineType engineType;
/**
* Page number, starting from 1, 0 indicates no paging (supported in 2.2.4 and later versions)
*/
public int pageIndex;
/**
* Page size, 0 indicates no paging (supported in 2.2.4 and later versions)
*/
public int pageSize;

SearchResult

public class SearchResult {
/**
* The total number of mini programs returned in this search
*/
public int total;
/**
* The list of mini programs returned in this search. If a paging parameter is specified, only the current paging list is returned.
*/
public List<MiniApp> miniAppList;
}

ShareData

/**
* Share source, value from ShareSource
*/
public int shareSource;
/**
* Share target, value from ShareTarget
*/
public int shareTarget;
/**
* ID set in the share panel, used to distinguish sharing channels
*/
public int shareItemId;
/**
* Share title
*/
public String title;
/**
* Share summary
*/
public String summary;
/**
* Share image path Can be a local image path or a network image path
*/
public String sharePicPath;
/**
* Whether it is a local image. If true, sharePicPath is the local image path; otherwise, it is the network image path.
*/
public boolean isLocalPic;
/**
* Field obtained from the server: Share link
*/
public String targetUrl;
/**
* Mini program package information
*/
protected MiniAppInfo miniAppInfo;

ShareSource

public static class ShareSource {

public static final int INNER_BUTTON = 11; // From an internal button of the mini program or mini game
public static final int MORE_BUTTON = 12; // From the More option in the capsule button
}

ShareTarget

public static class ShareTarget {
public static final int WECHAT_FRIEND = 3; // Share to WeChat contact
public static final int WECHAT_MOMENTS = 4; // Share on WeChat Moments
}

ShareResult

public static class ShareResult {
public static final int SUCCESS = 0;// Share successful
public static final int FAIL = 1;// Share failed
public static final int CANCEL = 2;// Share cancelled
}

MiniStartLinkOptions

public class MiniStartLinkOptions {
/**
* Whether to force update when opening the mini program (effective for cold startup). false: Prioritizes using local cache while asynchronously fetching the latest data. true: Opens the mini program only after receiving a network response.
*/
public boolean isForceUpdate = false;
/**
* Entry path
*/
public String entryPath;
/**
* Receives error messages during the mini program launch process
*/
public ResultReceiver resultReceiver;

/**
* Mini program launch parameters
*/
public String params;
}

MiniInitConfig

/**
* Name of the configuration file in the assets
*/
private String configAssetName;
/**
* Custom configuration file path
*/
private String configFilePath;
/**
* Configuration file content
*/
private String configJsonStr;
/**
* SDK log feature
*/
private boolean debug;
/**
* Configures an external shark instance
*/
private IShark shark;
/**
* Whether to verify the package name in the configuration file when loading it
*/
private boolean verifyPkg;
/**
* Whether to use Tencent Browser Service X5
*/
private boolean isUserX5Core = true;
/**
* Whether to force the use of the core base library from assets
*/
private boolean forceUseBaseLibInAsset;
/**
* Path for preset offline package assets
*/
private String assetPathOfPresets;

IMiniAppContext

/**
* Returns mini program information
*/
MiniAppInfo getMiniAppInfo();

MiniAppInfo

public String appId; // Mini program appid
public String name; // Mini program name
public String iconUrl; // URL of the mini program icon
public String version; // Mini program version number
public int verType; // Mini program type: development, preview, or released version

IpcCallback

public interface IpcCallback {
/**
* Callback for process communication
* @param isSucc - Whether the callback was successful
* @param response - The response data
*/
void result(boolean isSucc, Bundle response);
}

IpcRequestEvent

public Context context;
// Data associated with the request
public Bundle data;
// The callback for the response
public IpcCallback callback;

RequestEvent

// Reference to the mini program activity
public WeakReference<Activity> activityRef;
// Event name
public String event;
// Event parameters
public String jsonParams;

AppState

/**
* Mini program starting
*/
int STATE_START = 1;
/**
* Mini program switched to the foreground
*/
int STATE_FOREGROUND = 2;
/**
* Mini program closed using the capsule button
*/
int STATE_CLOSE = 3;
/**
* Mini program switched to the background
*/
int STATE_BACKGROUND = 4;
/**
* Mini program destroyed
*/
int STATE_DESTROY = 5;

MiniAppEvent

/**
* Mini program information
*/
public MiniApp miniApp;
/**
* Whether it is a hot start
*/
public boolean isHotStart;

PreDownloadInfo

/**
* Mini program appid
*/
public String appId;
/**
* Whether to download the mini program package
*/
public boolean isDownload;

IDownloadCallback

/**
* Callback for successful download
*
* @param downloadInfo
*/
void onFinish(DownloadInfo downloadInfo);

/**
* Callback for failed download
*
* @param downloadInfo
*/
void onError(DownloadInfo downloadInfo);

DownloadInfo

// IOEXCEPTION and IllegalAccessException occur during the download process
public static final int CODE_DOWNLOAD_IOEXCEPTION = -100001;
// An exception occurs during the download process
public static final int CODE_DOWNLOAD_EXCEPTION = -100002;
// No network connection
public static final int CODE_NO_NETWORK = -100003;
// Invalid download parameters
public static final int CODE_PARAM_ERROR = -100004;
// Download directory creation failed
public static final int CODE_DOWNLOAD_DIR_CREATE_FAIL = -100005;
// Mini program package parsing failed
public static final int CODE_MINI_APP_PARSE_FAIL = -12013;

/**
* Mini program appid
*/
private String appId;
/**
* Error code
*/
private int errCode;
/**
* Error message
*/
private String message;

IMiniAppFileManager

/**
* Gets the absolute path of a wx file
* @param wxFilePath
* @return
*/
String getAbsolutePath(String wxFilePath);

/**
* Converts an absolute path to a wx file
* @param path
* @return
*/
String getWxFilePath(String path);

/**
* Gets a temporary directory
* @param suffix
* @return
*/
String getTmpPath(String suffix);

BaseJsPlugin

/**
* Mini program context
*/
protected IMiniAppContext mMiniAppContext;
/**
* Mini program information
*/
protected MiniAppInfo mMiniAppInfo;
/**
* Mini program package information
*/
protected ApkgInfo mApkgInfo;

MiniEngineType

public enum MiniEngineType {
MiniApp, // Mini program
MiniGame // Mini game
}

ChooseMediaProxy.IChooseMediaListener

interface IChooseMediaListener {
/**
* @param result - Whether the media file is successfully selected, true indicates success
* @param uris - List of selected media files, returns empty list if selection failed
*/
void onResult(boolean result, ArrayList<Uri> uris);
}

ChooseMediaOptions

public class ChooseMediaOptions {
public static final int SIZE_TYPE_ORIGINAL = 0x01; // Full-size image
public static final int SIZE_TYPE_COMPRESS = 0x02; // Compressed image

public static final int MEDIA_TYPE_IMAGE = 0; // Image
public static final int MEDIA_TYPE_VIDEO = 1; // Video
public static final int MEDIA_TYPE_MIX = 2; // Mixed mode

public static final int CAMERA_TYPE_FRONT = 0; // Front camera
public static final int CAMERA_TYPE_BACK = 1; // Rear camera

public int maxCount = 1; // Maximum number of files to select in multi-file selection
public int sizeType = SIZE_TYPE_ORIGINAL; // Full-size or compressed, can use SIZE_TYPE_ORIGINAL|SIZE_TYPE_COMPRESS to support both options (it is up to the user's choice)
public int mediaType = MEDIA_TYPE_IMAGE; // Image, video, or mixed mode
public int duration; // Maximum video recording duration in seconds. The time range is between 3s and 60s. Videos selected from the album have no duration limit.
public int camera; // Use front or rear camera (only effective for chooseMediaFromCamera)
public Uri cameraOutput; // Output file path for camera mode. Non-null means the SDK has created it, and null means the proxy needs to handle it
}

MoreItem

// Menu items on the More panel
public class MoreItem {
public static final int MIN_EXT_ITEM_ID = 100; // The minimum extended id of MoreItem
public static final int MAX_EXT_ITEM_ID = 200; // The maximum extended id of MoreItem
private static final int FIRST_BUILTIN_ITEM = 1;
public static final int SHARE_QQ = FIRST_BUILTIN_ITEM;
public static final int SHARE_QZONE = FIRST_BUILTIN_ITEM + 1;
public static final int SHARE_WX_FRIEND = FIRST_BUILTIN_ITEM + 2;
public static final int SHARE_WX_MOMENT = FIRST_BUILTIN_ITEM + 3;
public static final int ABOUT = FIRST_BUILTIN_ITEM + 4;
public static final int COMPLAINT = FIRST_BUILTIN_ITEM + 5;
public static final int DEBUG = FIRST_BUILTIN_ITEM + 6;
public static final int MONITOR = FIRST_BUILTIN_ITEM + 7;
public static final int RESTART = FIRST_BUILTIN_ITEM + 8;
public static final int FAVORITE = FIRST_BUILTIN_ITEM + 9;
public static final int SHORTCUT = FIRST_BUILTIN_ITEM + 10;
public static final int QQ_FAVORITE = FIRST_BUILTIN_ITEM + 11;
public static final int EXPORT_LOG = FIRST_BUILTIN_ITEM + 12;
public static final int SETTING = FIRST_BUILTIN_ITEM + 13;
public static final int COPY_LINK = FIRST_BUILTIN_ITEM + 14;
public int id; // Item Id
public boolean visible; // Whether it is visible
public int drawable; // Item drawable resource ID
public String drawableUri; //Item drawable uri
public String text; // Item title
public String contentDescription; // Visual accessibility description for the item
public boolean isCustomShare; // Whether to customize sharing
public String shareKey; // Customize the share key, which should match the custom settings in the mini program
public MoreItemClickListener onClickListener; // Tap event
}

MoreItem.MoreItemClickListener

public class MoreItem {
public interface MoreItemClickListener {
/**
* Tap listener
*
* @param context - Mini program context
* @param item - The menu item that was tapped
*/
void onClick(IMiniAppContext context, MoreItem item);
}
}

MoreItemList.Builder

public class MoreItemList extends ArrayList<MoreItem> {
/**
* Adds "Share" button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addAbout(String text, int drawableResId);
public Builder addAbout(String text, int drawableResId, String contentDescription);
public Builder addAbout(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds "Copy link" button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addCopyLink(String text, int drawableResId);
public Builder addCopyLink(String text, int drawableResId, String contentDescription);
public Builder addCopyLink(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds "Complaint" button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addComplaint(String text, int drawableResId);
public Builder addComplaint(String text, int drawableResId, String contentDescription);
public Builder addComplaint(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds "Debug" button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addDebug(String text, int drawableResId);
public Builder addDebug(String text, int drawableResId, String contentDescription);
public Builder addDebug(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds “Restart” button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addRestart(String text, int drawableResId);
public Builder addRestart(String text, int drawableResId, String contentDescription);
public Builder addRestart(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds “Create shortcut” button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addShortcut(String text, int drawableResId);
public Builder addShortcut(String text, int drawableResId, String contentDescription);
public Builder addShortcut(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);
/**
* Adds “Settings” button
@param text - Button text
* @param drawableResId - Button icon
* @param contentDescription - Visual accessibility description
* @param listener - Tap listener
* @return
*/
public Builder addSetting(String text, int drawableResId);
public Builder addSetting(String text, int drawableResId, String contentDescription);
public Builder addSetting(String text, int drawableResId, String contentDescription, MoreItem.MoreItemClickListener listener);

/**
* Adds “Customize” button
* @param moreItem
* @return
*/
public Builder addMoreItem(MoreItem moreItem);
}

PermissionInfo

public class PermissionInfo {
public String id; // Permission ID, corresponding to scopName
public String name; // Permission title
public String description; // Permission description
public String rejectDescription; // Description of the permission rejection
public String settingPageTitle; // The permission title displayed on the settings page
}

MiniAuthState

public class MiniAuthState {
// Not authorized
public static final int AUTH_FLAG_NONE = 0x00000001;
// Authorized
public static final int AUTH_FLAG_GRANTED = 0x00000002;
// Rejected
public static final int AUTH_FLAG_REJECTED = 0x00000004;

/**
* Permission ID
*/
public String scopeName;
/**
* Permission authorization status
*/
public int authFlag;
}

MiniAuthInfo

public class MiniAuthInfo {
// Mini program information
public MiniApp miniApp;
// Mini program appid
public String appId;
// Mini program name
public String miniAppName;
// Mini program icon
public String miniIconUrl;
// Permission name
public String scopeName;
// Authorization pop-up title
public String authTitle;
// Authorization pop-up description
public String authDesc;
// Masked value for sensitive information such as mobile number and email address, e.g.: 135****888
public String maskValue;
// Rejection callback (required)
public View.OnClickListener refuseListener;
// Authorization callback (required)
public View.OnClickListener grantListener;
}

DialogInfo

public class DialogInfo {
private String title; // Title
private String message; // Message
private String positiveButtonText; // Positive button title
private String negativeButtonText; // Negative button title
private boolean cancelable = true; // Whether it is cancelable
private Integer positiveButtonColor; // Positive button title color
private Integer negativeButtonColor; // Negative button title color
private DialogInterface.OnClickListener positiveButtonListener; // Positive button tap listener
private DialogInterface.OnClickListener negativeButtonListener; // Negative button tap listener
private DialogInterface.OnDismissListener dismissListener; // Dialog box disappearance listener
private DialogInterface.OnCancelListener cancelListener; // Cancel listener
}

ActionSheetInfo

public class ActionSheetInfo {
private String title; // Title
private List<ActionSheetItem> items; // List of options
private boolean cancelable = true; // Whether the configuration can be cancelled
private String cancelText; // Text on the Cancel button
private OnItemClickListener itemClickListener; // Option tap listener
private DialogInterface.OnCancelListener cancelListener; // Cancellation listener
}

ActionSheetItem

public class ActionSheetItem {
private String text; // Text content
private Integer textColor; // Text color
private Drawable iconLeft; // Left icon
private Drawable iconTop; // Top icon
private Drawable iconRight; // Right icon
private Drawable iconBottom; // Bottom icon
}

ActionSheetInfo.OnItemClickListener

public interface OnItemClickListener {
/**
* Option tap event
* @param which Index of the tapped option
*/
void onClick(int which);
}


Was this page helpful?
You can also Contact Sales or Submit a Ticket for help.
Yes
No

Feedback