/** * Determines whether to force an update when opening the mini program (effective only the first time the mini program is opened after the app starts). false: Prioritizes using local cache while asynchronously fetching the latest data. true: Waits for the network response before opening the mini program. */ public boolean isForceUpdate = false; /** *The entry path, supports adding parameters in the format: path?key=value&key1=value1. */ public String entryPath; /** * Receives error information during the mini program startup process. */ public ResultReceiver ResultReceiver; /** * Parameters for launching the mini program. */ public String params; /** * Sets the task mode when opening the mini program * * false: Multi-task mode; true: Single-task mode */ public boolean isSingleTask;
/*** Operation was successful.*/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;/*** Issue with the mini program update type returned by the server*/public static final int C_SERVER_UPDATE_TYPE_ERROR = -11004;/*** Data parsing exception from the server*/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;////////////////////////////// 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*/public static final int C_CLIENT_NEED_LOGIN_PREVIEW_APP = -12002;/*** Data parsing exception*/public static final int C_CLIENT_JSON_EXCEPTION = -12003;/*** Missing mini program information*/public static final int C_CLIENT_MINI_APP_INFO_ERROR = -12005;/*** QR code error*/public static final int C_CLIENT_QRCODE_ERROR = -12006;/*** Invalid TMF 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;/*** Exception occurred while starting the mini program*/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;
/*** Released version of the mini program*/public static final int TYPE_ONLINE = MiniSDKConst.ONLINE;/*** Development version of the mini program*/public static final int TYPE_DEVELOP = MiniSDKConst.DEVELOP;/*** Preview of the mini program*/public static final int TYPE_PREVIEW = MiniSDKConst.PREVIEW;/*** Mini program ID*/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 URL*/public String iconUrl;/*** Mini program introduction*/public String appIntro;/*** Developer enterprise name*/public String appDeveloper;/*** Timestamp*/public long time;/*** Mini program engine type:* miniEngineType.miniApp: Mini program* MiniEngineType.MiniGame: Mini game*/public MiniEngineType engineType;
/*** Main entry point, "Recently used" list*/public static final int LAUNCH_SCENE_MAIN_ENTRY = 1001;/*** Scans the QR code to open*/public static final int LAUNCH_SCENE_QR_CODE_FROM_SCAN = 1011;/*** Searches and opens*/public static final int LAUNCH_SCENE_SEARCH = 2005;
/*** Searches 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, search both mini programs and mini games*/public MiniEngineType engineType;
/*** Source of the share, values from ShareSource*/public int shareSource;/*** Target of the share, values from ShareTarget*/public int shareTarget;/*** ID set in the share panel, used to distinguish sharing channels*/public int shareItemId;/*** Title of the share*/public String title;/*** Summary of the share*/public String summary;/*** The path of the share image. It is the path to a local image or a network image.*/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;
public static class ShareSource {public static final int INNER_BUTTON = 11;// From an internal button of the mini program or mini gamepublic static final int MORE_BUTTON = 12;// From the More option in the capsule button}
public static class ShareTarget {public static final int WECHAT_FRIEND = 3; // Shares to WeChat contactpublic static final int WECHAT_MOMENTS = 4; // Shares on WeChat Moments}
public static class ShareResult {public static final int SUCCESS = 0;// Shared successfullypublic static final int FAIL = 1;// Share failedpublic static final int CANCEL = 2;// Share cancelled}
public class MiniStartLinkOptions {/*** Whether to force update when opening the mini program (effective only the first time the mini program is opened after the app starts). false: Prioritizes using local cache while asynchronously fetching the latest data. true: Waits for the network response before opening the mini program.*/public boolean isForceUpdate = false;/*** Entry path*/public String entryPath;/*** Receives error information during the mini program startup process*/public ResultReceiver resultReceiver;/*** Parameters for launching the mini program*/public String params;}
/*** Name of the configuration file in the assets*/private String configAssetName;/*** Custom configuration file path*/private String configFilePath;/** * Content of the configuration file */ 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 base library in assets */ private boolean ForceUseBaselibinAsset;/** * Path to the preset offline package in assets */ private String assetPathOfPresets;
/*** Returns mini program information*/MiniAppInfo getMiniAppInfo();
public String appId; // Mini program APPIDpublic String name; // Mini program namepublic String iconUrl; // URL of the mini program iconpublic String version; // Mini program version numberpublic int verType; // Mini program type: development, preview, or official version
public interface IpcCallback {/*** Callback for inter-process communication* @param isSucc - Whether the callback was successful* @param response - The return data*/void result(boolean isSucc, Bundle response);}
public Context context;// The datapublic Bundle data;// The callback for the responsepublic IpcCallback callback;
// Mini program activitypublic WeakReference<Activity> activityRef;// Event namepublic String event;// Event parameterspublic String jsonParams;
/** * launches the mini program */ int STATE_START = 1; /** * Switches the mini program to the foreground */ int STATE_FOREGROUND = 2; /** * Taps the Close option on the capsule button to close the mini program */ int STATE_CLOSE = 3; /** * Switches the mini program to the backend */ int STATE_BACKGROUND = 4; /** * Destroys the mini program */ int int STATE_DESTROY = 5;
/** * Mini program information */ public MiniApp miniApp; /** * Whether it is hot startup */ public boolean isHotstart;
/** * Mini program appId */ public String appId;/** * Whether to download the mini program package */ public boolean isDownload;
/** * Callback for successful download * * @param downloadInfo */ void onFinish (downloadInfo downloadInfo); /** * Callback for failed download * * @param downloadInfo */ void onError (downloadInfo downloadInfo);
// Exceptions of IOException and IllegalAccessException occurred during download public static final int CODE_DOWNLOAD_IOEXCEPTION = -100001; // An exception occurred during download 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; // Failed to create the download directory public static final int CODE_DOWNLOAD_DIR_CREATE_FAIL = -100005; // Failed to parse the mini program package public static final int CODE_MINI_APP_PARSE_FAIL = -12013;/** * Mini program ID */ private String appId; /** * Error code */ private int errCode; /** * Error message */ private string message;
/** * Gets the absolute path of wxfile * @param wxFilePath * @return */ String getAbsolutePath (String wxFilePath); /** * Converts the absolute path to wxfile * @param path * @return */ String getWxFilePath (String path); /** * Gets the temporary directory * @param suffix * @return */ String getTmpPath (String suffix);
/*** Mini program context*/protected IMiniAppContext mMiniAppContext;/*** Mini program information*/protected MiniAppInfo mMiniAppInfo;/*** Mini program package information*/protected ApkgInfo mApkgInfo;
public enum MiniEngineType {miniApp, // Mini programMiniGame // Mini game}