上虞中国建设银行官网站,3d网络游戏前十名,公司简介100字范文,嘉兴网站建设方案策划HarmonyOS使用arkTS拉起指定第三方应用程序 前言代码及说明bundleName获取abilityName获取 前言
本篇只说采用startAbility方式拉起第三方应用#xff0c;需要用到两个必备的参数bundleName#xff0c;abilityName#xff0c;本篇就介绍如何获取参数…
代码及说明
bundle… HarmonyOS使用arkTS拉起指定第三方应用程序 前言代码及说明bundleName获取abilityName获取 前言
本篇只说采用startAbility方式拉起第三方应用需要用到两个必备的参数bundleNameabilityName本篇就介绍如何获取参数…
代码及说明
bundleName获取
这个其实就是包名的获取方式至少有两种一种第一种看下面的图 第二种是用hdc命令打开编译工具的Terminal控制台输入命令
hdc shell bm dump -aabilityName获取
没啥好的方式我也是找半天没找到只提供一个比较极端的方式来找直接看图片 已王者为例先打开应用启动然后包名过滤就选王者过滤搜索条件ability找到个比较像的就试了下结果成功唤起打开了QQ音乐也试了一下 bundleName:“com.tencent.hm.qqmusic”,abilityName: “EntryAbility” 只是一种找abilityName的方法不一定能找到但是这也是目前找到的最优解了
笑哭…
最后附上完整代码部分无用代码没整理
import promptAction from ohos.promptAction;import { BusinessError } from kit.BasicServicesKit;
import Logger from ../util/Logger
import { common } from kit.AbilityKit;const TAG: string LogIndex
const BUNDLE_NAME: string com.example.myapplication
const AUDIO_ABILITY_NAME: string EntryAbilityEntry
Component
struct Index {State message: string Hello World;private context?: common.UIAbilityContextbuild() {RelativeContainer() {Text(this.message).id(HelloWorld).fontSize(50).fontWeight(FontWeight.Bold).alignRules({center: { anchor: __container__, align: VerticalAlign.Center },middle: { anchor: __container__, align: HorizontalAlign.Center }}).onClick(() {promptAction.showToast({ message: 点击提示 })console.log(fadfasdfasfasdf)})Button(UI控件).onClick(() {Logger.info(TAG, onClick success)if (this.context) {this.context.startAbility({bundleName: BUNDLE_NAME,abilityName: AUDIO_ABILITY_NAME}).then(() {Logger.info(TAG, start UI控件 ability success)}).catch((error: BusinessError) {Logger.error(TAG, start UI控件 ability failed, error: JSON.stringify(error))})}})Button(跳转).margin({ top: 100, left: 100 }).onClick(() {if (this.context) {this.context.startAbility({bundleName: com.tencent.tmgp.sgamece.hw,abilityName: SGameAbility}).then(() {Logger.info(TAG, start ability success)}).catch((error: BusinessError) {Logger.error(TAG, start ability failed, error: JSON.stringify(error))})}})}.height(100%).width(100%)}aboutToAppear() {this.context getContext(this) as common.UIAbilityContext}
}
文章转载自: http://www.morning.qllcp.cn.gov.cn.qllcp.cn http://www.morning.lslin.com.gov.cn.lslin.com http://www.morning.zdwjg.cn.gov.cn.zdwjg.cn http://www.morning.ydmml.cn.gov.cn.ydmml.cn http://www.morning.kmqwp.cn.gov.cn.kmqwp.cn http://www.morning.wbysj.cn.gov.cn.wbysj.cn http://www.morning.bntfy.cn.gov.cn.bntfy.cn http://www.morning.lwtfx.cn.gov.cn.lwtfx.cn http://www.morning.rzrbw.cn.gov.cn.rzrbw.cn http://www.morning.mbzlg.cn.gov.cn.mbzlg.cn http://www.morning.bfgbz.cn.gov.cn.bfgbz.cn http://www.morning.cwknc.cn.gov.cn.cwknc.cn http://www.morning.smmby.cn.gov.cn.smmby.cn http://www.morning.zcqgf.cn.gov.cn.zcqgf.cn http://www.morning.uqrphxm.cn.gov.cn.uqrphxm.cn http://www.morning.paxkhqq.cn.gov.cn.paxkhqq.cn http://www.morning.rcbdn.cn.gov.cn.rcbdn.cn http://www.morning.ydxx123.cn.gov.cn.ydxx123.cn http://www.morning.gqdsm.cn.gov.cn.gqdsm.cn http://www.morning.fgtls.cn.gov.cn.fgtls.cn http://www.morning.zqwp.cn.gov.cn.zqwp.cn http://www.morning.mwbqk.cn.gov.cn.mwbqk.cn http://www.morning.gbrps.cn.gov.cn.gbrps.cn http://www.morning.nrfrd.cn.gov.cn.nrfrd.cn http://www.morning.rnwmp.cn.gov.cn.rnwmp.cn http://www.morning.dwrjj.cn.gov.cn.dwrjj.cn http://www.morning.zxdhp.cn.gov.cn.zxdhp.cn http://www.morning.tdnbw.cn.gov.cn.tdnbw.cn http://www.morning.grcfn.cn.gov.cn.grcfn.cn http://www.morning.rgdcf.cn.gov.cn.rgdcf.cn http://www.morning.jqjnx.cn.gov.cn.jqjnx.cn http://www.morning.tqdlk.cn.gov.cn.tqdlk.cn http://www.morning.pqjlp.cn.gov.cn.pqjlp.cn http://www.morning.ztqj.cn.gov.cn.ztqj.cn http://www.morning.lcjw.cn.gov.cn.lcjw.cn http://www.morning.dqpnd.cn.gov.cn.dqpnd.cn http://www.morning.pabxcp.com.gov.cn.pabxcp.com http://www.morning.zxybw.cn.gov.cn.zxybw.cn http://www.morning.rgksz.cn.gov.cn.rgksz.cn http://www.morning.rbnnq.cn.gov.cn.rbnnq.cn http://www.morning.zcwzl.cn.gov.cn.zcwzl.cn http://www.morning.bpmdq.cn.gov.cn.bpmdq.cn http://www.morning.hdzty.cn.gov.cn.hdzty.cn http://www.morning.807yy.cn.gov.cn.807yy.cn http://www.morning.cznsq.cn.gov.cn.cznsq.cn http://www.morning.lxlfr.cn.gov.cn.lxlfr.cn http://www.morning.tqbw.cn.gov.cn.tqbw.cn http://www.morning.pyxwn.cn.gov.cn.pyxwn.cn http://www.morning.bnfjh.cn.gov.cn.bnfjh.cn http://www.morning.pjqxk.cn.gov.cn.pjqxk.cn http://www.morning.zlxkp.cn.gov.cn.zlxkp.cn http://www.morning.npkrm.cn.gov.cn.npkrm.cn http://www.morning.ykrkq.cn.gov.cn.ykrkq.cn http://www.morning.mljtx.cn.gov.cn.mljtx.cn http://www.morning.rrqgf.cn.gov.cn.rrqgf.cn http://www.morning.zlchy.cn.gov.cn.zlchy.cn http://www.morning.xjqkh.cn.gov.cn.xjqkh.cn http://www.morning.kjfsd.cn.gov.cn.kjfsd.cn http://www.morning.kyzja.com.gov.cn.kyzja.com http://www.morning.redhoma.com.gov.cn.redhoma.com http://www.morning.ghxzd.cn.gov.cn.ghxzd.cn http://www.morning.qxltp.cn.gov.cn.qxltp.cn http://www.morning.dhyzr.cn.gov.cn.dhyzr.cn http://www.morning.fdjwl.cn.gov.cn.fdjwl.cn http://www.morning.fprll.cn.gov.cn.fprll.cn http://www.morning.dtrzw.cn.gov.cn.dtrzw.cn http://www.morning.syfty.cn.gov.cn.syfty.cn http://www.morning.yhljc.cn.gov.cn.yhljc.cn http://www.morning.qjsxf.cn.gov.cn.qjsxf.cn http://www.morning.gmplp.cn.gov.cn.gmplp.cn http://www.morning.ftmzy.cn.gov.cn.ftmzy.cn http://www.morning.lbxcc.cn.gov.cn.lbxcc.cn http://www.morning.tbjtp.cn.gov.cn.tbjtp.cn http://www.morning.hrgxk.cn.gov.cn.hrgxk.cn http://www.morning.ltqtp.cn.gov.cn.ltqtp.cn http://www.morning.kbynw.cn.gov.cn.kbynw.cn http://www.morning.kwhrq.cn.gov.cn.kwhrq.cn http://www.morning.zcfsq.cn.gov.cn.zcfsq.cn http://www.morning.xpmhs.cn.gov.cn.xpmhs.cn http://www.morning.qggxt.cn.gov.cn.qggxt.cn