openApp
The openApp API is called by the super app to open a mini program with its unique ID.
Method signature
copy
function openApp(
appId: string,
extra?: {
extraParams?: Map<string, any>;
success?: (success: BaseSuccess) => void;
error?: (error: BaseError) => void;
}
)
Request parameters
Field | Data type | Required | Description |
appId | string | Yes | The unique ID that is assigned by Mini Program Platform to identify a mini program. You can get the ID under the Mini Programs menu from the Mini Program Platform console. |
extra | Object | No | An extended attribute that is used to provide additional information if necessary. The included parameters are:
|
Response parameters
N/A
Result codes
Result code | Result message | Description | Further action |
1000 |
| The SDK opens the mini program successfully. | N/A |
2000 | The result message varies depending on the error that occurs. | The SDK encounters an error when attempting to open the mini program. | Refer to the result message for specific actions. |
Sample
copy
import { openApp } from 'iapminiprogram-rn';
import type { BaseSuccess, BaseError } from 'iapminiprogram-rn';
function openMiniApp(appId: string) {
openApp(appId, {
success: (success: BaseSuccess) => {
},
error: (error: BaseError) => {
},
});
}