HarmonyOS/OpenHarmony应用开发API-StartAbilityParameter能力

鸿蒙时代
发布于 2023-5-13 13:59
浏览
0收藏

说明:
定义启动Ability参数,可以作为入参调用startAbility启动指定的Ability。
仅在FA模型下使用。
编译环境:
编译器版本:release3.0
Api:8
语言:js
HarmonyOS/OpenHarmony应用开发API-StartAbilityParameter能力-鸿蒙开发者社区
代码示例:

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));
});

标签
HarmonyOSOpenHarmony应用开发API-StartAbi.docx 19.17K 8次下载
1
收藏
回复
举报
回复
    相关推荐