获取启动参数
业务场景
获取小游戏启动的参数,包括场景值,路径参数,媒体来源等
流程图
无
接口介绍
SDKManager.getLaunchOptions();
调用示例
const launchInfo = SDKManager.getLaunchOptions();
// 需要屏蔽游戏中心设首,复访入口
if (launchInfo.query.channel == 'nongchangleyuan' || launchInfo.query.gameCenterBackflow == 'false') {
// to do something....
}
// 游戏中心启动
if (launchInfo.query.sourceChannel == 'gamecenter') {
// to do something....
}
参数说明
出参:LaunchInfo info
参数名称 | 类型 | 说明 |
---|---|---|
scene | string | 启动小游戏的场景值 |
query | object | 启动小游戏的 query 参数 |
referrerInfo | object | 来源信息。从另一个 App 进入小游戏时返回 |
错误码
无
FAQ
更加详细的说明请参考my.getLaunchOptionsSync