openUrl
The openUrl API is called by the super app to open mini programs with url, the URL of the mini program.
Method signature
void openUrl(Context context, String url, Bundle extraParams, GriverContainerAPICallBack callBack)
Request parameters
Name | Type | Description | Required |
context | Context | Interface to global information about an application environment. | M |
url | String | The scheme URL of the mini program. The URL should use the HTTP or HTTPs protocols and include the _ariver_appid, _ariver_path, and _ariver_version query string parameters. You can get the URL from the Mini Program Platform console. | M |
extraParams | Bundle | This parameter is used to pass startup parameters to IAPMini Program SDK to customize the behavior of a mini program during startup. The passed parameters should be included in the definition of {@linkGriverParams.LaunchParams}. For how to specify the startup parameters, see Startup parameters. | O |
callback | The callback that is used to listen to mini program launch failures. | O |
Response parameters
Name | Type | Description | Required |
error | An object that is used to return the error code and error message when the mini program launch fails. | O |
Error codes
Error code | Error message | Description | Further action |
90002 | GRV_CONTAINER_NOT_INITIALIZED | IAPMiniProgram SDK is not initialized. | Initialize the SDK. |
90003 | GRV_CONTAINER_ERROR_UNKNOWN | Parameter error. | Refer to the Request parameters table and check if all parameter types are correct and if all required parameters are specified. |
Samples
Kotlin
val bundle = Bundle()
bundle.putString("query", "a=b&c=d")
Griver.openUrl(context, url, bundle,
GriverContainerAPICallBack { errorCode, errorMessage ->
//return the error code and error message if the mini program launch fails
})
Java
Bundle bundle = new Bundle();
bundle.putString("query", "a=b&c=d");
Griver.openUrl(context, appId, bundle, new GriverContainerAPICallBack() {
@Override
public void error(int errorCode, String errorMessage) {
//return the error code and error message if the mini program launch fails
}
});