提交 d429c717 编写于 作者: H HuangXW

add ServiceExtensionContext.startAbilityByCall api

Signed-off-by: NHuangXW <huangxinwei4@huawei.com>
上级 d92f3f65
......@@ -688,4 +688,42 @@ disconnectAbility(connection: number): Promise&lt;void&gt;;
}).catch((error) => {
console.log('failed:' + JSON.stringify(error));
});
```
\ No newline at end of file
```
## ServiceExtensionContext.startAbilityByCall
startAbilityByCall(want: Want): Promise&lt;Caller&gt;;
将指定Ability拉起到后台并获取其Caller通信接口,拉起方可使用Caller与被拉起的Ability进行通信。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | 是 | 传入需要启动的ability的信息,包含ability名称、模块名、包名、设备ID,设备ID缺省或为空表示启动本地ability。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise&lt;Caller&gt; | 获取要通讯的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.
先完成此消息的编辑!
想要评论请 注册