@@ -896,7 +896,7 @@ Obtains the caller interface of the specified ability, and if the specified abil
| Name| Type| Mandatory| Description|
| -------- | -------- | -------- | -------- |
| want | [Want](js-apis-application-Want.md) | Yes| Information about the target ability, including the ability name, bundle name, and device ID. If the device ID is left blank or the default value is used, it indicates the local device.|
| want | [Want](js-apis-application-Want.md) | Yes| Information about the ability to start, including **abilityName**, **moduleName**, **bundleName**, **deviceId** (optional), and **parameters** (optional). If **deviceId** is left blank or null, the local ability is started. If **parameters** is left blank or null, the ability is started in the background.|
**Return value**
...
...
@@ -907,22 +907,40 @@ Obtains the caller interface of the specified ability, and if the specified abil
**Example**
```js
importAbilityfrom'@ohos.application.Ability';
varcaller;
exportdefaultclassMainAbilityextendsAbility{
onWindowStageCreate(windowStage){
this.context.startAbilityByCall({
bundleName:"com.example.myservice",
abilityName:"MainAbility",
deviceId:""
}).then((obj)=>{
caller=obj;
console.log('Caller GetCaller Get '+caller);
}).catch((e)=>{
console.log('Caller GetCaller error '+e);
});
letcaller=undefined;
// Start an ability in the background without passing parameters.
varwantBackground={
bundleName:"com.example.myservice",
moduleName:"entry",
abilityName:"MainAbility",
deviceId:""
};
this.context.startAbilityByCall(wantBackground)
.then((obj)=>{
caller=obj;
console.log('GetCaller success');
}).catch((error)=>{
console.log(`GetCaller failed with ${error}`);
});
// Start an ability in the foreground with ohos.aafwk.param.callAbilityToForeground in parameters set to true.