华为应用市场(AppGallery)服务
提供应用更新检测、系统升级引导弹窗、跳转应用市场详情页与应用内促评能力,基于 AppGallery Kit(@kit.AppGalleryKit)。
const store = ymx.requirePlugin('ymx-huawei-app-gallery') as YmxHuaweiAppGallery;// 检查更新const res = await store.checkUpdate();if (res.updateAvailable) { await store.showUpdateDialog(); // 弹出系统升级引导(跳应用市场更新)}// 打开应用市场指定应用详情页(应用包名)await store.openAppDetail({ bundleName: 'com.example.myapp' });// 应用内促评await store.showCommentDialog(); 复制
const store = ymx.requirePlugin('ymx-huawei-app-gallery') as YmxHuaweiAppGallery;// 检查更新const res = await store.checkUpdate();if (res.updateAvailable) { await store.showUpdateDialog(); // 弹出系统升级引导(跳应用市场更新)}// 打开应用市场指定应用详情页(应用包名)await store.openAppDetail({ bundleName: 'com.example.myapp' });// 应用内促评await store.showCommentDialog();
只读
获取插件 ID
获取插件版本,如 1.2.3
1.2.3
检查应用是否有新版本
基于应用市场服务器版本信息,需应用已上架应用市场或已完成灰度发布。
是否可更新
const res = await store.checkUpdate();if (res.updateAvailable) { console.log('发现新版本:', res.versionName, res.versionCode); await store.showUpdateDialog();} 复制
const res = await store.checkUpdate();if (res.updateAvailable) { console.log('发现新版本:', res.versionName, res.versionCode); await store.showUpdateDialog();}
打开应用市场应用详情页
可选
参数(bundleName 为应用包名,不传时打开应用市场应用页)
打开成功
await store.openAppDetail({ bundleName: 'com.example.myapp' }); 复制
await store.openAppDetail({ bundleName: 'com.example.myapp' });
移除监听器
设置监听器,接收 eventName 事件名称,data 事件数据
注意: 此接口为覆盖操作,仅保留最后一个监听器,最后的 listener 才能收到事件通知。
拉起应用内评分评论弹窗
用户在应用内直接评分与评论,无需跳转应用市场详情页; 需应用已上架应用市场。
评论弹窗已拉起
await store.showCommentDialog(); 复制
await store.showCommentDialog();
弹出系统升级引导弹窗
需先调用 [checkUpdate] 且存在新版本;用户确认后系统跳转应用市场下载更新。
结果
await store.showUpdateDialog(); 复制
await store.showUpdateDialog();
华为应用市场(AppGallery)服务
提供应用更新检测、系统升级引导弹窗、跳转应用市场详情页与应用内促评能力,基于 AppGallery Kit(@kit.AppGalleryKit)。
示例