参考代码:
export default class IntentExecutorImpl extends InsightIntentExecutor {
onExecuteInUIAbilityForegroundMode(name: string, param: Record<string, Object>, pageLoader: window.WindowStage): insightIntent.ExecuteResult {
let want: Want = {
bundleName: 'xxx',
moduleName: 'entry',
abilityName: 'EntryAbility',
uri: 'xxx'
};
//报错
this.context.startAbility(want);
let result: insightIntent.ExecuteResult = {
code: 0
};
return result;
}
}
报错如下:
Reason:Error
Error name:Error
Error message:Operation not supported.
Error code:
Stacktrace:
at startAbility (/usr1/hmos_for_system/src/increment/sourcecode/foundation/ability/ability_runtime/frameworks/js/napi/insight_intent_context/insight_intent_context.js:23:23)
at onExecuteInUIAbilityForegroundMode (entry/src/main/ets/entryability/InsightIntentExecutorImpl.ets:48:9)
参考demo: