其他分享
首页 > 其他分享> > 【FAQ】【ARK UI】鸿蒙应用跳转至应用商店

【FAQ】【ARK UI】鸿蒙应用跳转至应用商店

作者:互联网

​ 【问题描述】

js或者ETS怎么跳转到应用商店

 

【问题答案】

参考链接

鸿蒙应用跳转至应用商店

【Harmony OS】【ARK UI】ets使用startAbility或startAbilityForResult方式调起Ability

代码如下

import featureAbility from '@ohos.ability.featureAbility'
import wantConstant from '@ohos.ability.wantConstant'
@Entry
@Component
struct Index {
  @State message: string = '跳转到QQ详情界面'
public onclick(){
  var str = {
    "want": {
      "deviceId": "",
      "bundleName": "",
      "abilityName": "",
      "uri":"market://details?id=com.tencent.mobileqq",
      "options": {},
      "flags":wantConstant.Flags.FLAG_ABILITY_NEW_MISSION,
      "action": "android.intent.action.VIEW",
      "parameters": {},
    },
    "abilityStartSetting": {}
  };
  featureAbility.startAbility(str)
    .then((data) => {
      console.info('Operation successful. Data: ' + JSON.stringify(data))
    }).catch((error) => {
    console.error('Operation failed. Cause: ' + JSON.stringify(error));
  })
}
  build() {
    Row() {
      Column() {
        Text(this.message)
          .fontSize(50)
          .fontWeight(FontWeight.Bold)
        .onClick(this.onclick.bind(this))
      }
      .width('100%')
    }
    .height('100%')
  }
}

【运行效果】

1cdcbda42e919fe1136632178a2957ec_490x946.gif%40900-0-90-f.gif

欲了解更多更全技术文章,欢迎访问https://developer.huawei.com/consumer/cn/forum/?ha_source=zzh

标签:wantConstant,商店,featureAbility,FAQ,UI,应用,error,跳转
来源: https://www.cnblogs.com/developer-huawei/p/16641710.html