基础库 1.1.0 开始支持,低版本需做兼容处理。
The scene value describes the path a user takes to enter a Mini Program. For a complete list of scene values and their meanings, refer to the Scene Value List.
Due to Android system limitations, it is currently not possible to obtain the scene value for the scenario where a user presses the Home button to exit to the desktop and then re-enters the Mini Program from the desktop. In this case, the previous scene value is retained.
Get Scene Value
You can obtain the scene value through the following methods:
- For Mini Program, you can obtain the aforementioned scene value in the
onLaunchandonShowofApp, or via wx.getLaunchOptionsSync. - For Mini Games, you can obtain the aforementioned scene value via wx.getLaunchOptionsSync and wx.onShow.
Scenarios for Returning Source Information
For certain scene values, the appId of the source app, official account, or Mini Program can also be retrieved. Please refer to the corresponding API reference documentation for details.
| Scene Value | Scenario | appId Meaning |
|---|---|---|
| 1020 | Mini Program list related to the official account profile page | Source official account |
| 1035 | Custom menu of the official account | Source official account |
| 1036 | App shared message card | Source App |
| 1037 | Open Mini Program from Mini Program | Source Mini Program |
| 1038 | Return from another Mini Program | Source Mini Program |
| 1043 | Official account template message | Source official account |
| 1069 | Mobile app | Source App |