Parameter configuration for mini program launching/*** Whether to force update when opening the mini program (effective only the first time the app is launched). false: Use local cache first and fetch the latest data asynchronously. true: Wait for the network response before opening the mini program.*/public boolean isForceUpdate = false;/*** Entry path, supports adding parameters: path?key=value&key1=value1*/public String entryPath;/*** Receive mini program startup errors*/public ResultReceiver resultReceiver;/**// Parameters for starting the mini program*/public String params;/*** Set the task mode for opening the mini program.** false: Multi-task mode, true: Single task mode*/public boolean isSingleTask;
/*** 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;/*** The server returns the code error*/public static final int C_SERVER_RET_CODE_ERROR = -11002;/*** The server returns the response is null*/public static final int C_SERVER_RESPONSE_NULL = -11003;/*** The server returns that the update type of mini program error.*/public static final int C_SERVER_UPDATE_TYPE_ERROR = -11004;/*** The server returns that an exception occurred while parsingdata*/public static final int C_SERVER_PARSE_DATA_ERROR = -11005;/*** Mini program does not exist or has been removed*/public static final int C_SERVER_TAKE_OFF = -11006;/** * Maximum monthly activity reached */ public static final int C_SERVER_MAU_LIMIT = -11007; /** * Resource limits */ public static final int C_SERVER_RES_LIMIT = -11008; /** * Frequency of single interface requests is too high */ public static final int C_SERVER_FREQ_LIMIT_API = -11011;//////////////////////////////Client-side error//////////////////////////////////public static final int C_CLIENT = -12000;/*** The Shark instance is empty*/public static final int C_CLIENT_SHARK_IS_NULL = -12001;/*** Previewing 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;/*** Code scanning exception*/public static final int C_CLIENT_SCAN_ERROR = -12004;/*** Mini program information is missing*/public static final int C_CLIENT_MINI_APP_INFO_ERROR = -12005;/*** Code scanning error*/public static final int C_CLIENT_QRCODE_ERROR = -12006;/*** The code is not a 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;/**// Mini program launching error*/public static final int C_CLIENT_START_MINI_APP_THROWABLE = -12010;/*** json parsing exception*/public static final int C_CLIENT_JSON_ERROR = -12011;/*** Failed to download mini program*/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;
/*** Official mini program*/public static final int TYPE_ONLINE = MiniSDKConst.ONLINE;/*** Debug mini program*/public static final int TYPE_DEVELOP = MiniSDKConst.DEVELOP;/*** Preview mini program*/public static final int TYPE_PREVIEW = MiniSDKConst.PREVIEW;/**Try out the mini program demo*/public static final int TYPE_EXPERIENCE = MiniSDKConst.EXPERIENCE;/*** Mini program ID*/public String appId;/*** Mini program version type (official/preview/developer)*/public int appVerType;/*** Mini program version*/public String version;/*** Mini program name*/public String name;/*** Mini program icon*/public String iconUrl;/*** Mini program overview*/public String appIntro;/*** Developer enterprise name*/public String appDeveloper;/*** Timestamp*/public long time;
/*** Main entry of the mini program, list of [recently used mini programs]*/public static final int LAUNCH_SCENE_MAIN_ENTRY = 1001;/*** Scan the QR code to open*/public static final int LAUNCH_SCENE_QR_CODE_FROM_SCAN = 1011;/*** Search and open*/public static final int LAUNCH_SCENE_SEARCH = 2005;
/*** Search keyword. When it is empty, all mini programs are searched for.*/public String keyWord = "";/*** Specify primary category*/public String firstLevelCate;/*** Specify the secondary category*/public String secondaryLevelCate;
/**Source of the share, which is value from ShareSource*/public int shareSource;/*** Target of the share, which is value from ShareTarget*/public int shareTarget;/*** ID for distinguishing share channels*/public int shareItemId;/*** Share title*/public String title;/*** Share summary*/public String summary;/*** Path to the share image, either local or network path Whether the image is local; true for local, false for network*/public String sharePicPath;/*** Whether it is a local image. If it is True, sharePicPath is the path to the local picture; otherwise, sharePicPath is the path to the picture from network*/public boolean isLocalPic;/*** Share link obtained from the server*/public String targetUrl;/**View the mini program package details.*/protected MiniAppInfo miniAppInfo;
public static class ShareSource {public static final int INNER_BUTTON = 11; // From mini program|internal button of mini gamespublic static final int MORE_BUTTON = 12; // From "More" option in the capsule button}
public static class ShareTarget {Public static final int QQ = 0;//Share to QQ contactsPublic static final int QZONE = 1;//Share to QQ Zonepublic static final int WECHAT_FRIEND = 4;//Share to Weixin contactspublic static final int WECHAT_MOMENTS = 4;// Sahre to Weixin 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 canceled}
public class MiniStartLinkOptions {/*** Whether to force the mini program to check for updates when it is opened (valid for the first time the app opens the mini program every time it is started), false: priority is given to using the local cache while obtaining the latest data asynchronously; true: wait for the network to return before opening the mini program*/public boolean isForceUpdate = false;/*** Entry address*/public String entryPath;/*** Receive error messages during mini program startup.*/public ResultReceiver resultReceiver./*** Mini-program startup parameters.*/public String params;}
/*** Configuration file name in assets*/private String configAssetName;/**Customize configuration file path*/private String configFilePath;/** * Profile Content */ private String configJsonStr;/*** imei, for background mini program push configuration*/private String imei;/*** SDK log switch*/private boolean debug;/*** Set up external shark instance*/private IShark shark;/*** When loading configuration file, whether to check the package name in the configuration file*/private boolean verifyPkg;/*** Whether to use x5 kernel*/private boolean isUserX5Core = true;/*** Whether to force use the kernel base library*/private boolean forceUseBaseLibInAsset;/*** Path to preset offline package in assets*/private String assetPathOfPresets;
/*** callback miniprogram info*/MiniAppInfo getMiniAppInfo();
public String appId;//appID of the mini program.public String name;//Name of the mini program.public String iconUrl;//url of the mini program icon.public String version;//mini program version numberpublic int verType;//Type of mini program: development, preview, official version.
public interface IpcCallback {/*** Callback for process communication* @param isSucc Whether the call is successful* @param response Returns data*/void result(boolean isSucc, Bundle response);}
public Context context;//datapublic Bundle data;//returns callbackpublic IpcCallback callback;
//Mini program activitypublic WeakReference<Activity> activityRef;//Event namepublic String event;//Event parameterspublic String jsonParams;
/*** Mini program launched*/int STATE_START = 1;/*** Mini program swithed to the foreground*/int STATE_FOREGROUND = 2;/*** Close mini program via capsule*/int STATE_CLOSE = 3;/*** Mini program switched to the background*/int STATE_BACKGROUND = 4;/*** Mini program destroyed*/int STATE_DESTROY = 5;
/*** Mini program information*/public MiniApp miniApp;/*** Whether it is a hot start*/public boolean isHotStart;
/*** Mini program appId*/public String appId;/*** Whether to download mini program package*/public boolean isDownload;
/*** Callback for successful download** @param downloadInfo*/void onFinish(DownloadInfo downloadInfo);/*** Callback failed** @param downloadInfo*/void onError(DownloadInfo downloadInfo);
//Download IOEXCEPTION and IllegalAccessException exceptionspublic static final int CODE_DOWNLOAD_IOEXCEPTION = -100001;//Download EXCEPTION exceptionpublic static final int CODE_DOWNLOAD_EXCEPTION = -100002;//No internetpublic static final int CODE_NO_NETWORK = -100003;//Download parameter errorpublic static final int CODE_PARAM_ERROR = -100004;/// Failed to create the download directorypublic static final int CODE_DOWNLOAD_DIR_CREATE_FAIL = -100005;/// Failed to create the download directorypublic static final int CODE_MINI_APP_PARSE_FAIL = -12013;/*** Mini program ID*/private String appId;/*** Error code*/private int errCode;/*** Error msg*/private String message;
/*** Get wxfile absolute path* Parameters wxFilePath* Returns*/String getAbsolutePath(String wxFilePath);/*** Converts an absolute path to a wxfile.* Parameters path* Returns*/String getWxFilePath(String path);/*** Get temporary directory* Parameter suffix* Returns*/String getTmpPath(String suffix);
/*** :: Mini program contexts*/protected IMiniAppContext mMiniAppContext;/*** Mini program information.*/protected MiniAppInfo mMiniAppInfo;/*** Mini program package information.*/protected ApkgInfo mApkgInfo; /** ** Applet package information */ protected ApkgInfo mApkgInfo; /**
Was this page helpful?