回复
HarmonyOS应用API-featureAbility.startAbility
鸿蒙时代
发布于 2022-11-1 15:22
浏览
0收藏
Api: featureAbility.startAbility
版本适配:Api6
作用:启动新的ability
示例代码:
callback形式:
import featureAbility from '@ohos.ability.featureAbility'
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.startAbility(
{
want:
{
action: "",
entities: [""],
type: "",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbility",
uri: ""
},
},
);
Promise形式:
import featureAbility from '@ohos.ability.featureAbility'
import wantConstant from '@ohos.ability.wantConstant'
featureAbility.startAbility(
{
want:
{
action: "action.system.home",
entities: ["entity.system.home"],
type: "MIMETYPE",
flags: wantConstant.Flags.FLAG_AUTH_READ_URI_PERMISSION,
deviceId: "",
bundleName: "com.example.startability",
abilityName: "com.example.startability.MainAbility",
uri: ""
},
}
).then((data) => {
console.info("==========================>startAbility=======================>");
});
标签
HarmonyOS应用API-featureAbility.startAbi.docx 17.02K 0次下载
赞
收藏
回复
相关推荐