HarmonyOS 鸿蒙Next如何跳转应用市场对应app详情页

发布于 1周前 作者 zlyuanteng 来自 鸿蒙OS

HarmonyOS 鸿蒙Next如何跳转应用市场对应app详情页

如何跳转应用市场对应app详情页?希望给代码参考一下

2 回复

应用未上线的话,不会跳转到应用详情页,跳转应用市场详情页可参考:

import Want from '[@ohos](/user/ohos).app.ability.Want';

import common from '[@ohos](/user/ohos).app.ability.common';

[@Entry](/user/Entry)

[@Component](/user/Component)

struct Index {

[@State](/user/State) appId: string = 'C1198478733497871104';

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('点击跳转到鸿蒙版应用市场详情页面')

.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%')

}

}

更多关于HarmonyOS 鸿蒙Next如何跳转应用市场对应app详情页的实战系列教程也可以访问 https://www.itying.com/category-93-b0.html


作为IT专家,对于HarmonyOS鸿蒙Next如何跳转应用市场对应app详情页的问题,以下是专业解答:

在HarmonyOS鸿蒙Next系统中,跳转至应用市场对应app的详情页,可采取以下方法:

  1. 使用Market协议:通过传入market://的链接,利用Android支持的标准market协议,可拉起设备上的所有应用商店。例如,market://details?id=pkgName(支持所有商店)或market://app.huawei.com.market.applink/details?id=pkgName(仅支持华为应用商店)。
  2. Deeplink链接:复制应用市场的deeplink链接,利用相关API直接跳转。例如,hiapplink://com.huawei.appmarket?appId=APPID&channelId=CHANNEL&referrer=REFERRER
  3. ArkUI中的Hyperlink组件:在ArkUI中,可通过Hyperlink组件设置应用图片,并配置为点击时跳转至应用详情页。若地址为deeplink,则直接跳转至应用市场详情页。

如果问题依旧没法解决请联系官网客服,官网地址是:https://www.itying.com/category-93-b0.html

回到顶部
AI 助手
你好,我是IT营的 AI 助手
您可以尝试点击下方的快捷入口开启体验!