HarmonyOS 如何打开电子市场相关应用页面?

HarmonyOS 如何打开电子市场相关应用页面?

HarmonyOS
2024-11-18 10:20:45
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
aquaa

​根据您的问题可以按照以下方式实现: 实现逻辑 基于context.startAbility方法拉起指定应用,并携带参数。其中type是固定配置值,uri是"store://appgallery.huawei.com/app/detail"拼接上id参数,才能拉起HarmonyOS 应用市场详情页面。

uri: ‘store://appgallery.huawei.com/app/detail?id=’+appId
  • 1.

详情请看demo:​

import Want from '@ohos.app.ability.Want'; 
import common from'@ohos.app.ability.common'; 
 
@Entry 
@Component 
struct Index { 
  @State appId: string = 'C1142586279411547392'; 
  controller: TextInputController = new TextInputController(); 
 
  build() { 
    Row() { 
      Column() { 
        TextInput({ 
          text: this.appId, 
          placeholder: 
          '请输入应用的appId', 
          controller: this.controller 
        }).width('90 %') 
        .onChange((value: string) => { 
          this.appId = value 
        }) 
        Button('点击跳转到HarmonyOS版应用市场详情页面') 
        .margin({ top: 50 }).onClick(() => { 
          const want: Want = { 
            uri: 'store://appgallery.huawei.com/app/detail?id' = ${this.appId } 
        }; 
        const context = getContext(this) as common.UIAbilityContext; 
        context.startAbility(want) 
          .then(() => { 
            //拉起成功 
          }).catch(() => { 
          //拉起失败 
        }); 
      }) 
    }.width(’100%‘) 
  }.height(‘100%’) 
} 
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
分享
微博
QQ
微信
回复
2024-11-18 16:27:46


相关问题
怎么跳转打开系统的应用市场app
3261浏览 • 1回复 待解决
HarmonyOS 应用市场详情页面地址
473浏览 • 1回复 待解决
HarmonyOS 如何打开应用权限设置页面
412浏览 • 1回复 待解决
如何跳转到应用市场app下载页面
8417浏览 • 1回复 待解决
HarmonyOS 如何拉起应用市场
816浏览 • 1回复 待解决
HarmonyOS 跳转应用市场
571浏览 • 1回复 待解决
HarmonyOS 如何通过应用市场更新
476浏览 • 1回复 待解决
如何拉起应用市场界面
3287浏览 • 1回复 待解决
HarmonyOS 如何打开应用
878浏览 • 2回复 待解决
HarmonyOS 跳转应用市场评分
847浏览 • 1回复 待解决
关于上架 HarmonyOS 市场相关问题
987浏览 • 1回复 待解决
HarmonyOS 跳转应用市场问题
584浏览 • 1回复 待解决
HarmonyOS应用升级跳转应用市场推荐
798浏览 • 1回复 待解决
HarmonyOS 应用市场评分机制
402浏览 • 1回复 待解决
求大佬告知如何跳转至应用市场
1123浏览 • 0回复 待解决