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

!4443 Fix docunment error of ability

Merge pull request !4443 from yuyaozhi/master
......@@ -6,7 +6,7 @@
## 导入模块
```js
import Context from "@ohos.app.context";
import featureAbility from '@ohos.ability.featureAbility'
```
## 使用说明
......
......@@ -32,7 +32,7 @@ getId(uri: string): number
**示例:**
```js
dataUriUtils.getIdSync("com.example.dataUriUtils/1221")
dataUriUtils.getId("com.example.dataUriUtils/1221")
```
......
......@@ -8,7 +8,7 @@ Ability的上下文环境,继承自Context。
## 导入模块
```js
import AbilityContext from '@ohos.application.abilityContext'
import Ability from '@ohos.application.Ability'
```
## 使用说明
......
......@@ -95,7 +95,8 @@ grantUserGrantedPermission(tokenID: number, permissionName: string, permissionFl
```js
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS");
let permissionFlag = 1;
let promise = AtManager.grantUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag);
promise.then(data => {
console.log(`promise: data->${JSON.stringify(data)}`);
});
......@@ -193,6 +194,7 @@ revokeUserGrantedPermission(tokenID: number, permissionName: string, permissionF
```js
var AtManager = abilityAccessCtrl.createAtManager();
let tokenID = 0;
let permissionFlag = 1;
AtManager.revokeUserGrantedPermission(tokenID, "ohos.permission.GRANT_SENSITIVE_PERMISSIONS",permissionFlag, data => {
console.log(`callback: data->${JSON.stringify(data)}`);
});
......
......@@ -9,7 +9,7 @@ Ability运行相关信息。
## 导入模块
```js
import AbilityRunningInfo from '@ohos.application.abilityRunningInfo';
import abilitymanager from '@ohos.application.abilityManager';
```
## 使用说明
......
......@@ -9,7 +9,7 @@ AbilityStage的上下文环境,继承自[Context](js-apis-application-context.
## 导入模块
```js
import AbilityStageContext from '@ohos.application.abilityStageContext';
import AbilityStage from '@ohos.application.AbilityStage';
```
## 使用说明
......
......@@ -11,7 +11,7 @@
## 导入模块
```
import MissionSnapshot from "@ohos.application.missionSnapshot";
import abilitymanager from '@ohos.application.abilityManager';
```
## 使用说明
......
......@@ -7,7 +7,7 @@
## 导入模块
```js
import AbilityDelegator from '@ohos.application.abilityDelegator'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
......
......@@ -7,7 +7,7 @@
## 导入模块
```js
import AbilityDelegatorArgs from '@ohos.application.abilityDelegatorArgs'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
......
......@@ -6,11 +6,7 @@
提供开发者运行代码的上下文环境,包括应用信息、ResourceManager等信息。
## 导入模块
```js
import Context from "@ohos.application.context";
```
## 使用说明
......
......@@ -7,7 +7,7 @@
## 导入模块
```js
import ShellCmdResult from '@ohos.application.shellCmdResult'
import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry'
```
......
......@@ -34,7 +34,7 @@ static isRunningInStabilityTest(callback: AsyncCallback<boolean>): void
```js
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest((err, flag) => {
console.log('startAbility result:' + JSON.stringfy(err));
console.log('startAbility result:' + JSON.stringify(err));
})
```
......@@ -58,9 +58,9 @@ static isRunningInStabilityTest(): Promise<boolean>
```js
import app from '@ohos.application.appManager';
app.isRunningInStabilityTest().then((flag) => {
console.log('success:' + JSON.stringfy(flag));
console.log('success:' + JSON.stringify(flag));
}).catch((error) => {
console.log('failed:' + JSON.stringfy(error));
console.log('failed:' + JSON.stringify(error));
});
```
......
......@@ -9,7 +9,7 @@
## 导入模块
```js
import EventHub from "@ohos.application.eventHub";
import Ability from '@ohos.application.Ability'
```
## 使用说明
......
......@@ -3,14 +3,13 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
```js
import DataShareExtensionAbility from '@ohos.application.DataShareExtensionAbility';
```
Extension的上下文环境,继承自Context。
## 导入模块
Extension的上下文环境,继承自Context。
```js
import ExtensionContext from "@ohos.application.extensionContext";
```
## 属性
......
......@@ -9,7 +9,7 @@ Extension运行相关信息。
## 导入模块
```js
import ExtensionRunningInfo from "@ohos.application.extensionRunningInfo";
import abilitymanager from '@ohos.application.abilityManager';
```
## 使用说明
......
......@@ -8,7 +8,7 @@ FormExtension的上下文环境,提供FormExtension具有的能力和接口,
## 导入模块
```js
import FormExtensionContext from '@ohos.application.formExtensionContext';
import FormExtension from '@ohos.application.FormExtension';
```
## FormExtensionContext.updateForm
......
......@@ -15,6 +15,9 @@ missionManager模块提供系统任务管理能力,开发者可以对系统任
import missionManager from '@ohos.application.missionManager'
```
## 权限列表
ohos.permission.MANAGE_MISSIONS
## missionManager.registerMissionListener
......@@ -143,6 +146,7 @@ getMissionInfo(deviceId: string, missionId: number, callback: AsyncCallback<M
```js
import missionManager from '@ohos.application.missionManager'
var allMissions=missionManager.getMissionInfos("",10).catch(function(err){console.log(err);});
missionManager.getMissionInfo("", allMissions[0].missionId, (error, mission) => {
console.log("getMissionInfo is called, error.code = " + error.code)
console.log("mission.missionId = " + mission.missionId);
......@@ -181,7 +185,7 @@ getMissionInfo(deviceId: string, missionId: number): Promise<MissionInfo>;
```js
import missionManager from '@ohos.application.missionManager'
var mission = missionManager.getMissionInfo("", id).catch(function (err){
var mission = missionManager.getMissionInfo("", 10).catch(function (err){
console.log(err);
});
```
......
......@@ -226,7 +226,7 @@ let wantAgentInfo = {
],
operationType: wantAgent.OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESET_FLAG]
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
};
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
......@@ -235,11 +235,11 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
text: "text"
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_TEXT,
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: basicContent
};
let request = {
content: notificatonContent,
content: notificationContent,
wantAgent: wantAgentObj
};
let id = 1;
......@@ -287,7 +287,7 @@ let wantAgentInfo = {
],
operationType: wantAgent.OperationType.START_ABILITY,
requestCode: 0,
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESET_FLAG]
wantAgentFlags: [wantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
};
wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
......@@ -296,11 +296,11 @@ wantAgent.getWantAgent(wantAgentInfo).then((wantAgentObj) => {
text: "text"
};
let notificationContent = {
contentType: notification.ContentType.NOTIFICATION_CONTENT_TEXT,
contentType: notification.ContentType.NOTIFICATION_CONTENT_BASIC_TEXT,
normal: basicContent
};
let request = {
content: notificatonContent,
content: notificationContent,
wantAgent: wantAgentObj
};
let id = 1;
......
......@@ -9,7 +9,7 @@
## 导入模块
```js
import PermissionRequestResult from '@ohos.application.permissionRequestResult'
import Ability from '@ohos.application.Ability'
```
## 属性
......
......@@ -11,7 +11,7 @@ Uri权限管理。
```
import uriPermissionManager from '@ohos.application.uriPermissionManager';
import UriPermissionManager from '@ohos.application.uriPermissionManager';
```
......
......@@ -919,7 +919,7 @@ WantAgent.equal(wantAgent1, wantAgent2).then((data) => {
getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;
获取WantAgent的操作类型(callback形式)。
获取一个WantAgent的OperationType信息(callback形式)。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......@@ -928,19 +928,59 @@ getOperationType(agent: WantAgent, callback: AsyncCallback\<number>): void;
| 名称 | 可读 | 可写 | 类型 | 必填 | 描述 |
| ---------- | --- | ---- | ------------------------ | ---- | --------------------------------------- |
| agent | 是 | 否 | WantAgent | 是 | WantAgent对象。 |
| callback | 是 | 否 | AsyncCallback\<number> | 是 | 获取WantAgent的操作类型。 |
| callback | 是 | 否 | AsyncCallback\<number> | 是 | 获取一个WantAgent的OperationType信息的回调方法。 |
**示例:**
```js
import WantAgent from '@ohos.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
var wantAgentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.setResultOnAbilityResultTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITIES,
requestCode: 0,
wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
}
WantAgent.getWantAgent(wantAgentInfo).then((data) => {
console.info("==========================>getWantAgentCallback=======================>");
wantAgent = data;
});
WantAgent.getOperationType(wantAgent, (OperationType) => {
console.log('----------- getOperationType ----------, OperationType: ' + OperationType);
})
```
## WantAgent.getOperationType
getOperationType(agent: WantAgent): Promise\<number>;
获取WantAgent的操作类型(Promise形式)。
获取一个WantAgent的OperationType信息(Promise形式)。
**系统能力**:SystemCapability.Ability.AbilityRuntime.Core
......@@ -954,12 +994,54 @@ getOperationType(agent: WantAgent): Promise\<number>;
| 类型 | 说明 |
| ----------------------------------------------------------- | ------------------------------------------------------------ |
| Promise\<number> | 以Promise形式返回获取WantAgent的操作类型。 |
| Promise\<number> | 以Promise形式返回获取optionType的结果。 |
**示例:**
```js
import WantAgent from '@ohos.wantAgent';
//wantAgent对象
var wantAgent;
//WantAgentInfo对象
var wantAgentInfo = {
wants: [
{
deviceId: "deviceId",
bundleName: "com.neu.setResultOnAbilityResultTest1",
abilityName: "com.example.test.MainAbility",
action: "action1",
entities: ["entity1"],
type: "MIMETYPE",
uri: "key={true,true,false}",
parameters:
{
mykey0: 2222,
mykey1: [1, 2, 3],
mykey2: "[1, 2, 3]",
mykey3: "ssssssssssssssssssssssssss",
mykey4: [false, true, false],
mykey5: ["qqqqq", "wwwwww", "aaaaaaaaaaaaaaaaa"],
mykey6: true,
}
}
],
operationType: OperationType.START_ABILITIES,
requestCode: 0,
wantAgentFlags:[WantAgent.WantAgentFlags.UPDATE_PRESENT_FLAG]
}
WantAgent.getWantAgent(wantAgentInfo).then((data) => {
console.info("==========================>getWantAgentCallback=======================>");
wantAgent = data;
});
WantAgent.getOperationType(wantAgent).then((OperationType) => {
console.log('getOperationType success, OperationType: ' + OperationType);
}).catch((err) => {
console.log('getOperationType fail, err: ' + err);
})
```
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册