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

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

时间:2022-08-31 08:55:56浏览次数:70  
标签:error wantConstant featureAbility FAQ 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

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

相关文章