> The initial APIs of this module are supported since API version 6. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the FA model.
## Modules to Import
...
...
@@ -834,7 +836,7 @@ Obtains information of the current ability. This API uses an asynchronous callba
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Implements the ability context. This module is inherited from **Context**.
...
...
@@ -55,7 +57,7 @@ Starts an ability. This API uses a callback to return the result.
varwant={
"deviceId":"",
"bundleName":"com.extreme.test",
"abilityName":"com.extreme.test.MainAbility"
"abilityName":"MainAbility"
};
this.context.startAbility(want,(error)=>{
console.log("error.code = "+error.code)
...
...
@@ -85,7 +87,7 @@ Starts an ability. This API uses a callback to return the result.
varwant={
"deviceId":"",
"bundleName":"com.extreme.test",
"abilityName":"com.extreme.test.MainAbility"
"abilityName":"MainAbility"
};
varoptions={
windowMode:0,
...
...
@@ -123,7 +125,7 @@ Starts an ability. This API uses a promise to return the result.
varwant={
"deviceId":"",
"bundleName":"com.extreme.test",
"abilityName":"com.extreme.test.MainAbility"
"abilityName":"MainAbility"
};
varoptions={
windowMode:0,
...
...
@@ -374,7 +376,7 @@ Obtains the caller interface of the specified ability, and if the specified abil
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Manages the ability lifecycle and context.
...
...
@@ -347,7 +349,7 @@ Sends sequenceable data to the target ability.
onWindowStageCreate(windowStage){
this.context.startAbilityByCall({
bundleName:"com.example.myservice",
abilityName:"com.example.myservice.MainAbility",
abilityName:"MainAbility",
deviceId:""
}).then((obj)=>{
caller=obj;
...
...
@@ -420,7 +422,7 @@ Sends sequenceable data to the target ability and obtains the sequenceable data
onWindowStageCreate(windowStage){
this.context.startAbilityByCall({
bundleName:"com.example.myservice",
abilityName:"com.example.myservice.MainAbility",
abilityName:"MainAbility",
deviceId:""
}).then((obj)=>{
caller=obj;
...
...
@@ -459,7 +461,7 @@ Releases the caller interface of the target ability.
onWindowStageCreate(windowStage){
this.context.startAbilityByCall({
bundleName:"com.example.myservice",
abilityName:"com.example.myservice.MainAbility",
abilityName:"MainAbility",
deviceId:""
}).then((obj)=>{
caller=obj;
...
...
@@ -500,7 +502,7 @@ Registers a callback that is invoked when the stub on the target ability is disc
> The initial APIs of this module are supported since API version 9. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> The APIs of this module can be used only in the stage model.
Implements the context that provides the capabilities and APIs of **ServiceExtension**. This class is inherited from **ExtensionContext**.
## Modules to Import
```
import ExtensionContext from '@ohos.application.ServiceExtensionAbility';
```
## startAbility
...
...
@@ -25,13 +31,18 @@ Starts an ability. This API uses a callback to return the result.