[文章]HarmonyOS应用API-featureAbility.startAbility

阅读量0
0
1

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=======================>");

});

回帖

声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容图片侵权或者其他问题,请联系本站作侵删。 侵权投诉
链接复制成功,分享给好友