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

!13564 翻译完成:12420+12420+12450+12448+12452+12470

Merge pull request !13564 from wusongqing/TR12420
......@@ -24,13 +24,13 @@ Obtains the ID attached to the end of a given URI.
| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | --------------------------- |
| uri | string | Yes | URI object from which the ID is to be obtained.|
| uri | string | Yes | Target URI object.|
**Return value**
| Type | Description |
| ------ | ------------------------ |
| number | ID obtained from the URI object.|
| number | ID obtained.|
**Example**
......@@ -52,7 +52,7 @@ Attaches an ID to the end of a given URI.
| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | --------------------------- |
| uri | string | Yes | URI object to which an ID is to be attached.|
| uri | string | Yes | Target URI object.|
| id | number | Yes | ID to be attached. |
**Return value**
......@@ -99,6 +99,8 @@ Deletes the ID from the end of a given URI.
dataUriUtils.deleteId("com.example.dataUriUtils/1221")
```
## dataUriUtils.updateId
updateId(uri: string, id: number): string
......@@ -111,7 +113,7 @@ Updates the ID in a given URI.
| Name| Type | Mandatory| Description |
| ---- | ------ | ---- | ------------------- |
| uri | string | Yes | URI object to be updated.|
| uri | string | Yes | Target URI object.|
| id | number | Yes | New ID. |
**Return value**
......
# @ohos.app.ability.wantAgent
The **app.ability.WantAgent** module provides APIs for triggering, canceling, and comparing **WantAgent** objects. You can use the APIs to create a **WantAgent** object, and obtain the user ID, bundle name, and want information of the object. You are advised to use this module, since it will replace the [@ohos.wantAgent](js-apis-wantAgent.md) module in the near future.
The **app.ability.wantAgent** module provides APIs for triggering, canceling, and comparing **WantAgent** objects. You can use the APIs to create a **WantAgent** object, and obtain the user ID, bundle name, and want information of the object.
> **NOTE**
>
......@@ -27,8 +27,6 @@ Obtains a **WantAgent** object. This API uses an asynchronous callback to return
| info | WantAgentInfo | Yes | Information about the **WantAgent** object to obtain. |
| callback | AsyncCallback\<WantAgent\> | Yes | Callback used to return the **WantAgent** object.|
**Example**
```js
......@@ -161,7 +159,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses an asynchronous
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -173,7 +171,7 @@ function getWantAgentCallback(err, data) {
console.info('----getWantAgent failed!----');
}
}
// WantAgentInfo object
//WantAgentInfo object
var wantAgentInfo = {
wants: [
{
......@@ -242,7 +240,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -310,7 +308,7 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -391,7 +389,7 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -437,7 +435,6 @@ try {
```
## WantAgent.getWant
getWant(agent: WantAgent, callback: AsyncCallback\<Want\>): void
......@@ -461,7 +458,7 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -504,7 +501,7 @@ var wantAgentInfo = {
try {
WantAgent.getWantAgent(wantAgentInfo, getWantAgentCallback)
//getWantص
// getWant callback
function getWantCallback(err, data) {
console.info("==========================>getWantCallback=======================>");
}
......@@ -544,7 +541,7 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -612,7 +609,7 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -689,11 +686,11 @@ Cancels a **WantAgent** object. This API uses a promise to return the result.
**Example**
```ts
```js
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -762,7 +759,7 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -826,7 +823,7 @@ try {
equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean\>): void
Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -844,7 +841,7 @@ Checks whether two **WantAgent** objects are equal. This API uses an asynchronou
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent1;
var wantAgent2;
......@@ -905,7 +902,7 @@ try {
equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean\>
Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -928,7 +925,7 @@ Checks whether two **WantAgent** objects are equal. This API uses a promise to r
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent1;
var wantAgent2;
......@@ -995,7 +992,7 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron
```js
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -1065,7 +1062,7 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to
```js
import WantAgent from '@ohos.app.ability.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......
......@@ -3,6 +3,7 @@
The **Configuration** module defines environment change information.
> **NOTE**
>
> The initial APIs of this module are supported since API version 8. Newly added APIs will be marked with a superscript to indicate their earliest API version.
> This module is deprecated since API version 9. You are advised to use [@ohos.app.ability.Configuration](js-apis-app-ability-configuration.md) instead.
......
......@@ -18,11 +18,11 @@ You can obtain the value of this constant by calling the **ConfigurationConstant
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| COLOR_MODE_NOT_SET | -1 | Unspecified color mode.|
| COLOR_MODE_DARK | 0 | Dark mode.|
| COLOR_MODE_LIGHT | 1 | Light mode.|
| COLOR_MODE_NOT_SET | -1 | Unspecified color mode.|
| COLOR_MODE_DARK | 0 | Dark mode.|
| COLOR_MODE_LIGHT | 1 | Light mode.|
## ConfigurationConstant.Direction<sup>9+</sup>
......@@ -31,11 +31,11 @@ You can obtain the value of this constant by calling the **ConfigurationConstant
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| DIRECTION_NOT_SET | -1 | Unspecified direction.|
| DIRECTION_VERTICAL | 0 | Vertical direction.|
| DIRECTION_HORIZONTAL | 1 | Horizontal direction.|
| DIRECTION_NOT_SET | -1 | Unspecified direction.|
| DIRECTION_VERTICAL | 0 | Vertical direction.|
| DIRECTION_HORIZONTAL | 1 | Horizontal direction.|
## ConfigurationConstant.ScreenDensity<sup>9+</sup>
......@@ -44,12 +44,12 @@ You can obtain the value of this constant by calling the **ConfigurationConstant
**System capability**: SystemCapability.Ability.AbilityBase
| Name| Value| Description|
| Name| Value| Description|
| -------- | -------- | -------- |
| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.|
| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.|
| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.|
| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.|
| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.|
| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.|
| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.|
| SCREEN_DENSITY_NOT_SET | 0 | Unspecified screen resolution.|
| SCREEN_DENSITY_SDPI | 120 | The screen resolution is sdpi.|
| SCREEN_DENSITY_MDPI | 160 | The screen resolution is mdpi.|
| SCREEN_DENSITY_LDPI | 240 | The screen resolution is ldpi.|
| SCREEN_DENSITY_XLDPI | 320 | The screen resolution is xldpi.|
| SCREEN_DENSITY_XXLDPI | 480 | The screen resolution is xxldpi.|
| SCREEN_DENSITY_XXXLDPI | 640 | The screen resolution is xxxldpi.|
# AppStateData
The **AppStateData** module defines the application state data.
The **AppStateData** module defines the application state data, which can be obtained through [getForegroundApplications](js-apis-app-ability-appManager.md#appmanagergetforegroundapplications).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
**System API**: This is a system API and cannot be called by third-party applications.
| Name | Type | Mandatory| Description |
| ----------- | -------- | ---- | ------------------------------------------------------------ |
| bundleName<sup>8+</sup> | string | No | Bundle name of the application. |
| uid<sup>8+</sup> | number | No | User ID.|
| state<sup>8+</sup> | number | No | Application state.|
| Name | Type | Mandatory | Description |
| ------------------------- | ------ | ---- | --------- |
| bundleName<sup>8+</sup> | string | No | Bundle name.|
| uid<sup>8+</sup> | number | No | User ID. |
| state<sup>8+</sup> | number | No | Application state. |
**Example**
```ts
import appManager from "@ohos.application.appManager"
appManager.getForegroundApplications((error, data) => {
for(let i=0; i<data.length; i++) {
for (let i = 0; i < data.length; i++) {
let appStateData = data[i];
console.info('appStateData.bundleName: ' + appStateData.bundleName);
console.info('appStateData.uid: ' + appStateData.uid);
......
# MissionListener
The **MissionListener** module defines the listeners used to observe the mission status.
The **MissionListener** module defines the listeners used to observe the mission status. The listeners can be registered by using [registerMissionListener](js-apis-application-missionManager.md#missionmanagerregistermissionlistener).
**System capability**: SystemCapability.Ability.AbilityRuntime.Mission
......
# TriggerInfo
The **TriggerInfo** module defines the information required for triggering the WantAgent.
The **TriggerInfo** module defines the information required for triggering the WantAgent. The information is used as an input parameter of [trigger](js-apis-app-ability-wantAgent.md#wantagenttrigger).
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
| Name | Type | Mandatory| Description |
| ---------- | --- |-------------------- | ----------- |
| code | number | Yes | Result code.|
| code | number | Yes | Result code. |
| want | Want | No | Want. |
| permission | string | No | Permission. |
| extraInfo | {[key: string]: any} | No | Extra information. |
**Example**
```ts
import wantAgent from '@ohos.wantAgent';
let wantAgentInfo = {
wants: [
{
deviceId: "",
bundleName: "com.example.apicoverhaptest",
abilityName: "com.example.apicoverhaptest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true.true,false}",
parameters: {
myKey0: 2222
}
}
],
operationType: wantAgent.OperationType.START_ABILITIES,
requestCode: 0,
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG],
extraInfo:{
"key": "value"
}
}
let triggerInfo = {
code: 0,
want: {
deviceId: "",
bundleName: "com.example.apicoverhaptest",
abilityName: "com.example.apicoverhaptest.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true.true,false}",
parameters: {
myKey0: 2222
}
},
permission: ""
extraInfo:{
"key": "value"
}
}
wantAgent.trigger(wantAgentInfo, triggerInfo).then((data) =>{
console.info("trigger data: " + JSON.stringify(data));
}).catch((err) => {
console.error("trigger err: " + JSON.stringify(err));
})
```
......@@ -218,8 +218,8 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
**Return value**
| Type | Description |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Type | Description |
| ----------------- | ------------------------------------------------ |
| Promise\<string\> | Promise used to return the bundle name.|
**Example**
......@@ -228,7 +228,7 @@ Obtains the bundle name of a **WantAgent** object. This API uses a promise to re
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -292,7 +292,7 @@ Obtains the user ID of a **WantAgent** object. This API uses an asynchronous cal
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -369,7 +369,7 @@ Obtains the user ID of a **WantAgent** object. This API uses a promise to return
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -424,10 +424,10 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba
**Parameters**
| Name | Type | Mandatory| Description |
| -------- | --------------------- | ---- | ------------------------------- |
| agent | WantAgent | Yes | Target **WantAgent** object. |
| callback | AsyncCallback\<Want\> | Yes | Callback used to return the want.|
| Name | Type | Mandatory | Description |
| -------- | --------------------- | --------- | --------------------------------- |
| agent | WantAgent | Yes | Target **WantAgent** object. |
| callback | AsyncCallback\<Want\> | Yes | Callback used to return the want. |
**Example**
......@@ -435,7 +435,7 @@ Obtains the want in a **WantAgent** object. This API uses an asynchronous callba
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -498,15 +498,15 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th
**Parameters**
| Name | Type | Mandatory| Description |
| ----- | --------- | ---- | ------------- |
| agent | WantAgent | Yes | Target **WantAgent** object.|
| Name | Type | Mandatory | Description |
| ----- | --------- | --------- | ---------------------------- |
| agent | WantAgent | Yes | Target **WantAgent** object. |
**Return value**
| Type | Description |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<Want\> | Promise used to return the want.|
| Type | Description |
| --------------- | -------------------------------- |
| Promise\<Want\> | Promise used to return the want. |
**Example**
......@@ -514,7 +514,7 @@ Obtains the want in a **WantAgent** object. This API uses a promise to return th
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -578,7 +578,7 @@ Cancels a **WantAgent** object. This API uses an asynchronous callback to return
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -655,7 +655,7 @@ Cancels a **WantAgent** object. This API uses a promise to return the result.
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -711,7 +711,7 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur
| Name | Type | Mandatory| Description |
| ----------- | ----------------------------- | ---- | ------------------------------- |
| agent | WantAgent | Yes | Target **WantAgent** object. |
| triggerInfo | TriggerInfo | Yes | **TriggerInfo** object. |
| triggerInfo | TriggerInfo | Yes | **TriggerInfo** object. |
| callback | AsyncCallback\<CompleteData\> | No | Callback used to return the result.|
**Example**
......@@ -720,7 +720,7 @@ Triggers a **WantAgent** object. This API uses an asynchronous callback to retur
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// getWantAgent callback
......@@ -779,7 +779,7 @@ WantAgent.trigger(wantAgent, triggerInfo, triggerCallback)
equal(agent: WantAgent, otherAgent: WantAgent, callback: AsyncCallback\<boolean\>): void
Checks whether two **WantAgent** objects are equal. This API uses an asynchronous callback to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses an asynchronous callback to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -797,7 +797,7 @@ Checks whether two **WantAgent** objects are equal. This API uses an asynchronou
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent1;
var wantAgent2;
......@@ -854,7 +854,7 @@ WantAgent.equal(wantAgent1, wantAgent2, equalCallback)
equal(agent: WantAgent, otherAgent: WantAgent): Promise\<boolean\>
Checks whether two **WantAgent** objects are equal. This API uses a promise to return the result.
Checks whether two **WantAgent** objects are equal to determine whether the same operation is from the same application. This API uses a promise to return the result.
**System capability**: SystemCapability.Ability.AbilityRuntime.Core
......@@ -877,7 +877,7 @@ Checks whether two **WantAgent** objects are equal. This API uses a promise to r
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent1;
var wantAgent2;
......@@ -940,7 +940,7 @@ Obtains the operation type of a **WantAgent** object. This API uses an asynchron
```js
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......@@ -1006,7 +1006,7 @@ Obtains the operation type of a **WantAgent** object. This API uses a promise to
```js
import WantAgent from '@ohos.wantAgent';
// WantAgent object
// wantAgent object
var wantAgent;
// WantAgentInfo object
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册