HarmonyOS 应用通过StartAbility的方式拉起了三方支付应用,在三方支付应用点击取消无法跳回当前App

代码实现如下:

let want: Want = {
  uri: `alipays://platformapi/startapp?appId=60000...pClearTop=false&startMultApp=YES&sign_params=${item.creditAuthLink}`
};
try {
  context.startAbility(want)
    .then(() => {
      console.log('start ability success.');
    })
    .catch((err: BusinessError) => {
      console.log(`start ability failed. Code is ${err.code}, message is ${err.message}`);
    })
} catch (paramError) {
  console.log(`Failed to start ability. Code is ${paramError.code}, message is ${paramError.message}`);
}
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.

工程中 module.json5的配置如下:

"skills": [{
  "entities": [
    "entity.system.home",
    "entity.system.browsable"
  ],
  "actions": [
    "action.system.home",
    "ohos.want.action.viewData"
  ],
  "uris": [{
    "scheme": "metro",
    "host": "metro.shanghai.app.com.firstride"
  }]
}]
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
HarmonyOS
2024-12-23 13:48:44
浏览
收藏 0
回答 1
回答 1
按赞同
/
按时间
zxjiu

目前没办法模拟打开三方支付应用应用,写了一个跳转应用市场可以返回到该应用的demo可以参考一下:

import common from '@ohos.app.ability.common';
import Want from '@ohos.app.ability.Want';

@Entry
@Component
struct Index {
  @State appId: string = '上架应用市场的AppID';
  build() {
    Column() {
      Button("跳转应用市场").onClick(() => {
        const want: Want = {
          uri: 'store://appgallery.huawei.com/app/detail?id=${this.appId}'
        };
        let context = getContext(this) as common.UIAbilityContext;
        context.startAbility(want).then(()=>{
          //拉起成功
        }).catch(()=>{
          // 拉起失败
        });
      }).margin(15)
    }
    .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.
分享
微博
QQ
微信
回复
2024-12-23 16:12:36


相关问题
HarmonyOS 打开三方应用
519浏览 • 1回复 待解决
三方应用使用蓝牙功能
1538浏览 • 1回复 待解决
如何将三方应用改为系统应用
1833浏览 • 2回复 已解决
HarmonyOS 唤起到三方地图应用
533浏览 • 1回复 待解决
HarmonyOS 使用第三方应用打开
600浏览 • 1回复 待解决
HarmonyOS 如何拉起三方地图APP
499浏览 • 1回复 待解决
三方应用如何获取蓝牙mac地址
2728浏览 • 1回复 待解决
三方应用如何获取http代理信息
2368浏览 • 1回复 待解决
HarmonyOS 通过scheme如何唤起三方APP
761浏览 • 1回复 待解决
应用内 FFmpeg 开源三方编译
1899浏览 • 1回复 待解决
HarmonyOS三方应用安装和卸载广播
990浏览 • 0回复 待解决
HarmonyOS三方APP跳转
407浏览 • 1回复 待解决
三方应用如何拿到蓝牙mac地址
903浏览 • 1回复 待解决
三方应用可以读取联系人数据吗?
754浏览 • 1回复 待解决
HarmonyOS三方应用自动化发布咨询
663浏览 • 1回复 待解决