This topic describes how to use a deeplink to navigate to a miniapp.
In the context of a miniapp, in addition to tapping the miniapp from the miniapp market to navigate to the miniapp homepage, you may want the users to access the miniapp by using the following methods:
Tap a notification to navigate to a specific page within the miniapp.
Tap a banner to navigate to a specific page within the miniapp.
Tap a link on an HTML5 page to navigate to a specific page within the miniapp.
Navigate to a specific page within the miniapp from within another app.
You only need to define the deeplink syntax of the miniapp to implement the preceding methods.
Deeplink syntax
A deeplink consists of the following five components:
scheme://miniapp/startapp?appId=[appId]&path=[path]&query=[query]
Parameter | Description | Example |
scheme | The schema of the deeplink. Use the schema defined by Superapp. | emasSuperapp |
miniapp/startapp | The URL path of the deeplink. Use the path defined by Superapp. | Miniapp/startapp |
appId=[appId] | The unique ID of the miniapp, which can be obtained from Application Open Platform of Enterprise Mobile Application Studio (EMAS). | 15116638413925671xxxxx |
path=[path] | The path to a specific page within the miniapp. This parameter is optional. If no path is specified, users are redirected to the homepage of the miniapp. | Before URL encoding: /about/index After URL encoding: %2Fabout%2Findex |
query=[query] | A placeholder in the deeplink where query parameters can be included and passed to the miniapp. If you do not need to pass parameters to the miniapp, you can leave this parameter empty. | Before URL encoding: key1=value1&key2=value2 After URL encoding: key1%3Dvalue1%26key2%3Dvalue2 |
Example
The following example describes how to start a miniapp whose ID is 1511663841392567144448 in EMAS Superapp.
Open the homepage of the miniapp
If you want to open the homepage of the miniapp, perform the following steps:
Generate a deeplink: emassuperapp://miniapp/startapp?appId=1511663841392567144448
Send the deeplink to Superapp.
Superapp parses the deeplink and obtains the miniapp ID.
Start the miniapp by using the miniapp API. For information about how to start an Android miniapp, see Start a miniapp. For information about how to start an iOS miniapp, see Start a miniapp.
Open a specific page within the miniapp
If you want to open a specific page within the miniapp, such as the about page of a WindWane miniapp, perform the following steps:
Generate a deeplink: emassuperapp://miniapp/startapp?appId=1511663841392567144448&path=%2Fabout
Send the deeplink to Superapp.
Superapp parses the deeplink and obtains the miniapp ID and the path to the page.
Start the miniapp by using the miniapp API. For information about how to start an Android miniapp, see Open a specific page within a miniapp. For information about how to start an ios miniapp, see Open a specific page within a miniapp.
Open a specific page within the miniapp and pass parameters to the page
For example, if you want to open the about page of a WindVane app and pass the name parameter with a value of EMAS to the page, perform the following steps:
Generate a deeplink: emassuperapp://miniapp/startapp?appId=1511663841392567144448&path=%2Fabout&name=EMAS
Send the deeplink to Superapp.
Superapp parses the deeplink and obtains the miniapp ID, the path to the page, and the name parameter value.
Start the miniapp by using the miniapp API. For information about how to start an Android miniapp, see Open a specific page within a miniapp. For information about how to start an ios miniapp, see Open a specific page within a miniapp.