未验证 提交 da362e9e 编写于 作者: O openharmony_ci 提交者: Gitee

!7396 新增 ServiceExtensionContext.startAbilityByCall 接口

Merge pull request !7396 from HuangXW/develop
......@@ -718,4 +718,42 @@ disconnectAbility(connection: number): Promise<void>;
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
});
```
\ No newline at end of file
```
## ServiceExtensionContext.startAbilityByCall
startAbilityByCall(want: Want): Promise<Caller>;
将指定Ability拉起到后台并获取其Caller通信接口,拉起方可使用Caller与被拉起的Ability进行通信。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | 是 | 传入需要启动的ability的信息,包含ability名称、模块名、包名、设备ID,设备ID缺省或为空表示启动本地ability。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise<Caller> | 获取要通讯的caller对象。 |
**示例:**
```js
let caller = undefined;
this.context.startAbilityByCall({
bundleName: "com.example.myservice",
moduleName: "entry",
abilityName: "MainAbility",
deviceId: ""
}).then((obj) => {
caller = obj;
console.log('Caller GetCaller Get ' + caller);
}).catch((e) => {
console.log('Caller GetCaller error ' + e);
});
```
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册