[文章]HarmonyOS/OpenHarmony应用开发API-StartAbilityParameter能力

阅读量0
0
2

说明:

定义启动Ability参数,可以作为入参调用startAbility启动指定的Ability

仅在FA模型下使用。

编译环境:

编译器版本:release3.0

Api:8

语言:js
1.png

代码示例:

import featureAbility from '@ohos.ability.featureAbility';

let Want = {
    bundleName: 'com.example.abilityStartSettingApp2',
    abilityName: 'com.example.abilityStartSettingApp.MainAbility',
};

let abilityStartSetting ={
    [featureAbility.AbilityStartSetting.BOUNDS_KEY] : [100,200,300,400],
    [featureAbility.AbilityStartSetting.WINDOW_MODE_KEY] :
    featureAbility.AbilityWindowConfiguration.WINDOW_MODE_UNDEFINED,
    [featureAbility.AbilityStartSetting.DISPLAY_ID_KEY] : 1,
};

let startAbilityParameter = {
    want : Want,
    abilityStartSetting : abilityStartSetting
};

featureAbility.startAbility(startAbilityParameter, (err, data)=>{
    console.log('errCode : ' + JSON.stringify(err));
    console.log('data : ' + JSON.stringify(data));
});

回帖

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