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

!2405 Done! 2122:Fix spelling errors of ability

Merge pull request !2405 from wusongqing/TR2122
# AbilityConstant
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API version 9.
Provides parameters related to ability launch.
## Modules to Import
```js
import AbilityConstant from '@ohos.application.AbilityConstant';
```
## Attributes
| Name| Type| Readable| Writable| Description|
| -------- | -------- | -------- | -------- | -------- |
| launchReason | LaunchReason| Yes| Yes| Ability launch reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| lastExitReason | LastExitReason | Yes| Yes| Reason for the last exit.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.LaunchReason
Enumerates ability launch reasons.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| START_ABILITY | 1 | Ability startup.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| CALL | 2 | Call.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| CONTINUATION | 3 | Ability continuation.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.LaunchReason
Enumerates reasons for the last exit.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| UNKNOWN | 0 | Unknown reason.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| ABILITY_NOT_RESPONDING | 1 | The ability does not respond.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| NORMAL | 2 | Normal status.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## AbilityConstant.OnContinueResult
Enumerates ability continuation results.
| Name | Value | Description |
| ----------------------------- | ---- | ------------------------------------------------------------ |
| AGREE | 0 | Continuation agreed.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| REJECT | 1 | Continuation denied.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
| MISMATCH | 2 | Mismatch.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
# Application Context<a name="EN-US_TOPIC_0000001173324607"></a>
## Module to Import<a name="s1959b1529f574b74861e62008289bb21"></a>
```
import app from '@system.app';
```
## Required Permissions<a name="section11257113618419"></a>
None
## app.getInfo<a name="s0e8ff40704e442bc87a848afa47bdfbb"></a>
getInfo\(\): <[AppResponse](#t3e93239d9b134b80957bcdd4acb05291)\>
Obtains the declared information in the **config.json** file of an application.
- Return values
**Table 1** AppResponse
<a name="t3e93239d9b134b80957bcdd4acb05291"></a>
<table><tbody><tr id="recc81d9f995d44aa87ba9d714b756569"><td class="cellrowborder" valign="top" width="19%"><p id="aa3137ce511d140fba6cc93513a7a91e3"><a name="aa3137ce511d140fba6cc93513a7a91e3"></a><a name="aa3137ce511d140fba6cc93513a7a91e3"></a>Name</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a6b166163db284e5ca8dc0190b36ae40a"><a name="a6b166163db284e5ca8dc0190b36ae40a"></a><a name="a6b166163db284e5ca8dc0190b36ae40a"></a>Type</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a4ba8ead9ee7b48298d9a6ed10659f13b"><a name="a4ba8ead9ee7b48298d9a6ed10659f13b"></a><a name="a4ba8ead9ee7b48298d9a6ed10659f13b"></a>Description</p>
</td>
</tr>
<tr id="row2557173813243"><td class="cellrowborder" valign="top" width="19%"><p id="p898462584011"><a name="p898462584011"></a><a name="p898462584011"></a>appID<sup id="sup193948321350"><a name="sup193948321350"></a><a name="sup193948321350"></a>6+</sup></p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="p698492564013"><a name="p698492564013"></a><a name="p698492564013"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="p1998432514020"><a name="p1998432514020"></a><a name="p1998432514020"></a>Bundle name of the application. It uniquely identifies the application.</p>
</td>
</tr>
<tr id="r64430cb15b54497f88ea6330b9a7454c"><td class="cellrowborder" valign="top" width="19%"><p id="a7cccea39636b47cd83188d400eed51e3"><a name="a7cccea39636b47cd83188d400eed51e3"></a><a name="a7cccea39636b47cd83188d400eed51e3"></a>appName</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a2f72300143c441ef9a3fb5dc2f8e4aac"><a name="a2f72300143c441ef9a3fb5dc2f8e4aac"></a><a name="a2f72300143c441ef9a3fb5dc2f8e4aac"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a1c9b8d1829ef489e9e0fd1863190d228"><a name="a1c9b8d1829ef489e9e0fd1863190d228"></a><a name="a1c9b8d1829ef489e9e0fd1863190d228"></a>Application name</p>
</td>
</tr>
<tr id="r4f8f612a65b24ae9b75ae53893aeb3b9"><td class="cellrowborder" valign="top" width="19%"><p id="ae036f88e139e4379abdaf4969f0720ea"><a name="ae036f88e139e4379abdaf4969f0720ea"></a><a name="ae036f88e139e4379abdaf4969f0720ea"></a>versionName</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="a1d379931a20144f0b6d98f5396202cd9"><a name="a1d379931a20144f0b6d98f5396202cd9"></a><a name="a1d379931a20144f0b6d98f5396202cd9"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="a70c91c442f7c41439a90ceb9041252e8"><a name="a70c91c442f7c41439a90ceb9041252e8"></a><a name="a70c91c442f7c41439a90ceb9041252e8"></a>Application version name</p>
</td>
</tr>
<tr id="r89cf0afd5f444bd1b66ace0c31a25cda"><td class="cellrowborder" valign="top" width="19%"><p id="a3a86c086e40e475b8fb26cf43fe9a8d6"><a name="a3a86c086e40e475b8fb26cf43fe9a8d6"></a><a name="a3a86c086e40e475b8fb26cf43fe9a8d6"></a>versionCode</p>
</td>
<td class="cellrowborder" valign="top" width="13%"><p id="abcfd352ff3d84552938de0e2daf0703e"><a name="abcfd352ff3d84552938de0e2daf0703e"></a><a name="abcfd352ff3d84552938de0e2daf0703e"></a>number</p>
</td>
<td class="cellrowborder" valign="top" width="68%"><p id="af943e2ec7622407387d25d9331a01245"><a name="af943e2ec7622407387d25d9331a01245"></a><a name="af943e2ec7622407387d25d9331a01245"></a>Application version</p>
</td>
</tr>
</tbody>
</table>
- Example
```
export default {
getInfo(){
var info = app.getInfo();
console.log(JSON.stringify(info));
}
}
```
## app.terminate<a name="section974325124119"></a>
terminate\(\): void
Destroys the current ability.
- Example
```
export default {
terminate(){
app.terminate();
}}
```
# Application Configuration<a name="EN-US_TOPIC_0000001173324675"></a>
## Module to Import<a name="section15536249155915"></a>
```
import configuration from '@system.configuration';
```
## Required Permissions<a name="section8152081004"></a>
None
## configuration.getLocale<a name="section8389829903"></a>
getLocale\(\): <[LocaleResponse](#table1544853546)\>
Obtains the current locale of the application, which is the same as the system locale.
- Return values
**Table 1** LocaleResponse
<a name="table1544853546"></a>
<table><thead align="left"><tr id="row1670755549"><th class="cellrowborder" valign="top" width="17.77177717771777%" id="mcps1.2.4.1.1"><p id="p57013505413"><a name="p57013505413"></a><a name="p57013505413"></a>Name</p>
</th>
<th class="cellrowborder" valign="top" width="12.5012501250125%" id="mcps1.2.4.1.2"><p id="p9706511540"><a name="p9706511540"></a><a name="p9706511540"></a>Type</p>
</th>
<th class="cellrowborder" valign="top" width="69.72697269726973%" id="mcps1.2.4.1.3"><p id="p16701957548"><a name="p16701957548"></a><a name="p16701957548"></a>Description</p>
</th>
</tr>
</thead>
<tbody><tr id="row15709513545"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p1370154548"><a name="p1370154548"></a><a name="p1370154548"></a>language</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p19701653545"><a name="p19701653545"></a><a name="p19701653545"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p37010510548"><a name="p37010510548"></a><a name="p37010510548"></a>Current language of the application, for example, <strong id="b1260120418488"><a name="b1260120418488"></a><a name="b1260120418488"></a>zh</strong>.</p>
</td>
</tr>
<tr id="row970165135413"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p97055105414"><a name="p97055105414"></a><a name="p97055105414"></a>countryOrRegion</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1770175115413"><a name="p1770175115413"></a><a name="p1770175115413"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p77015518544"><a name="p77015518544"></a><a name="p77015518544"></a>Country or region, for example, <strong id="b6258316114819"><a name="b6258316114819"></a><a name="b6258316114819"></a>CN</strong>.</p>
</td>
</tr>
<tr id="row6332114185611"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p53321542567"><a name="p53321542567"></a><a name="p53321542567"></a>dir</p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1433216410564"><a name="p1433216410564"></a><a name="p1433216410564"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p33321417565"><a name="p33321417565"></a><a name="p33321417565"></a>Text layout direction. Available values are as follows:</p>
<a name="ul1861816241119"></a><a name="ul1861816241119"></a><ul id="ul1861816241119"><li><strong id="b16720155216481"><a name="b16720155216481"></a><a name="b16720155216481"></a>ltr</strong>: The text direction is from left to right.</li><li><strong id="b1910563194919"><a name="b1910563194919"></a><a name="b1910563194919"></a>rtl</strong>: The text direction is from right to left.</li></ul>
</td>
</tr>
<tr id="row165137101137"><td class="cellrowborder" valign="top" width="17.77177717771777%" headers="mcps1.2.4.1.1 "><p id="p1351311101333"><a name="p1351311101333"></a><a name="p1351311101333"></a>unicodeSetting<sup id="sup1646171814502"><a name="sup1646171814502"></a><a name="sup1646171814502"></a>5+</sup></p>
</td>
<td class="cellrowborder" valign="top" width="12.5012501250125%" headers="mcps1.2.4.1.2 "><p id="p1513121019313"><a name="p1513121019313"></a><a name="p1513121019313"></a>string</p>
</td>
<td class="cellrowborder" valign="top" width="69.72697269726973%" headers="mcps1.2.4.1.3 "><p id="p97106183311"><a name="p97106183311"></a><a name="p97106183311"></a>Unicode key set determined by the locale.</p>
<p id="p213145115319"><a name="p213145115319"></a><a name="p213145115319"></a>For example, <strong id="b14471162633518"><a name="b14471162633518"></a><a name="b14471162633518"></a>{"nu":"arab"}</strong> indicates that the current locale uses Arabic numerals.</p>
<p id="p849701364"><a name="p849701364"></a><a name="p849701364"></a>If the current locale does not have a specific key set, an empty set is returned.</p>
</td>
</tr>
</tbody>
</table>
- Example
```
export default {
getLocale() {
const localeInfo = configuration.getLocale();
console.info(localeInfo.language);
}
}
```
# ServiceExtension # ServiceExtensionAbility
> ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE** > ![icon-note.gif](public_sys-resources/icon-note.gif) **NOTE**
> The initial APIs of this module are supported since API 8. Newly added APIs will be marked with a superscript to indicate their earliest API version. > 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.
Provides APIs related to **ServiceExtension**. Provides APIs related to **ServiceExtension**.
...@@ -10,13 +10,13 @@ Provides APIs related to **ServiceExtension**. ...@@ -10,13 +10,13 @@ Provides APIs related to **ServiceExtension**.
## Modules to Import ## Modules to Import
``` ```
import ServiceExtension from '@ohos.application.ServiceExtension'; import ServiceExtension from '@ohos.application.ServiceExtensionAbility';
``` ```
## Required Permissions ## Required Permissions
None None.
## Attributes ## Attributes
...@@ -26,7 +26,7 @@ None ...@@ -26,7 +26,7 @@ None
| context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core| | context | [ServiceExtensionContext](js-apis-service-extension-context.md) | Yes| No| Service extension context, which is inherited from **ExtensionContext**.<br>**System capability**: SystemCapability.Ability.AbilityRuntime.Core|
## onCreate ## ServiceExtensionAbility.onCreate
onCreate(want: Want): void; onCreate(want: Want): void;
...@@ -51,7 +51,7 @@ Called when an extension is created to initialize the service logic. ...@@ -51,7 +51,7 @@ Called when an extension is created to initialize the service logic.
``` ```
## onDestroy ## ServiceExtensionAbility.onDestroy
onDestroy(): void; onDestroy(): void;
...@@ -70,7 +70,7 @@ Called when this extension is destroyed to clear resources. ...@@ -70,7 +70,7 @@ Called when this extension is destroyed to clear resources.
``` ```
## onRequest ## ServiceExtensionAbility.onRequest
onRequest(want: Want, startId: number): void; onRequest(want: Want, startId: number): void;
...@@ -96,7 +96,7 @@ Called after **onCreate** is invoked when an ability is started by calling **sta ...@@ -96,7 +96,7 @@ Called after **onCreate** is invoked when an ability is started by calling **sta
``` ```
## onConnect ## ServiceExtensionAbility.onConnect
onConnect(want: Want): rpc.RemoteObject; onConnect(want: Want): rpc.RemoteObject;
...@@ -136,7 +136,7 @@ Called after **onCreate** is invoked when an ability is started by calling **con ...@@ -136,7 +136,7 @@ Called after **onCreate** is invoked when an ability is started by calling **con
``` ```
## onDisconnect ## ServiceExtensionAbility.onDisconnect
onDisconnect(want: Want): void; onDisconnect(want: Want): void;
......
此差异已折叠。
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册