Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
4d9695f4
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
未验证
提交
4d9695f4
编写于
12月 19, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 19, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12624 优化基础对象API参加描述
Merge pull request !12624 from zhongjianfei/mm003
上级
8b4da2cf
b456ed6f
变更
46
隐藏空白更改
内联
并排
Showing
46 changed file
with
325 addition
and
565 deletion
+325
-565
zh-cn/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md
...n-dev/reference/apis/js-apis-bundleManager-abilityInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md
...v/reference/apis/js-apis-bundleManager-applicationInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-bundleManager-bundleInfo.md
...on-dev/reference/apis/js-apis-bundleManager-bundleInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md
...dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md
...ference/apis/js-apis-bundleManager-launcherAbilityInfo.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-bundleManager-metadata.md
...tion-dev/reference/apis/js-apis-bundleManager-metadata.md
+3
-0
zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md
...-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md
...ence/apis/js-apis-continuation-continuationExtraParams.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationResult.md
...reference/apis/js-apis-continuation-continuationResult.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
...dev/reference/apis/js-apis-inner-ability-abilityResult.md
+1
-12
zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md
...ev/reference/apis/js-apis-inner-ability-connectOptions.md
+4
-37
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md
...reference/apis/js-apis-inner-ability-dataAbilityHelper.md
+65
-111
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md
...erence/apis/js-apis-inner-ability-dataAbilityOperation.md
+9
-54
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md
...reference/apis/js-apis-inner-ability-dataAbilityResult.md
+5
-4
zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md
...rence/apis/js-apis-inner-ability-startAbilityParameter.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
...lication-dev/reference/apis/js-apis-inner-ability-want.md
+36
-33
zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md
...on-dev/reference/apis/js-apis-inner-app-appVersionInfo.md
+1
-13
zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md
...plication-dev/reference/apis/js-apis-inner-app-context.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md
...ation-dev/reference/apis/js-apis-inner-app-processInfo.md
+5
-4
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
...erence/apis/js-apis-inner-application-abilityDelegator.md
+3
-6
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md
...ce/apis/js-apis-inner-application-abilityDelegatorArgs.md
+1
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md
...eference/apis/js-apis-inner-application-abilityMonitor.md
+2
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md
...ence/apis/js-apis-inner-application-abilityRunningInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md
...erence/apis/js-apis-inner-application-abilityStateData.md
+2
-19
zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md
.../reference/apis/js-apis-inner-application-appStateData.md
+4
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md
...pis/js-apis-inner-application-applicationStateObserver.md
+8
-8
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
...n-dev/reference/apis/js-apis-inner-application-context.md
+6
-6
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md
...erence/apis/js-apis-inner-application-continueCallback.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
...ence/apis/js-apis-inner-application-continueDeviceInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md
...reference/apis/js-apis-inner-application-errorObserver.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md
...ce/apis/js-apis-inner-application-extensionRunningInfo.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
...ce/apis/js-apis-inner-application-formExtensionContext.md
+2
-0
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md
...erence/apis/js-apis-inner-application-missionCallbacks.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md
...rence/apis/js-apis-inner-application-missionDeviceInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
...v/reference/apis/js-apis-inner-application-missionInfo.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
...ference/apis/js-apis-inner-application-missionListener.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionParameter.md
...erence/apis/js-apis-inner-application-missionParameter.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md
...ference/apis/js-apis-inner-application-missionSnapshot.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-permissionRequestResult.md
...apis/js-apis-inner-application-permissionRequestResult.md
+11
-11
zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md
...v/reference/apis/js-apis-inner-application-processData.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md
...ence/apis/js-apis-inner-application-processRunningInfo.md
+7
-6
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInformation.md
...is/js-apis-inner-application-processRunningInformation.md
+9
-8
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
...apis/js-apis-inner-application-serviceExtensionContext.md
+50
-50
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
...erence/apis/js-apis-inner-application-uiAbilityContext.md
+40
-40
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md
...dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md
+1
-55
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
...v/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
+1
-34
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-bundleManager-abilityInfo.md
浏览文件 @
4d9695f4
...
...
@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
Ability信息,未做特殊说明的属性,
均通过
[
GET_ABILITY_INFO_DEFAULT
](
js-apis-bundleManager.md
)
获取
Ability信息,未做特殊说明的属性,
可以通过
[
getBundleInfo
](
js-apis-bundleManager.md#bundlemanagergetbundleinfo
)
获取,flag使用
[
GET_BUNDLE_INFO_WITH_ABILITY
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md#bundleflag
)
。
## AbilityInfo
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-applicationInfo.md
浏览文件 @
4d9695f4
...
...
@@ -3,7 +3,7 @@
> ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
应用程序信息,未做特殊说明的属性,
均通过
[
GET_APPLICATION_INFO_DEFAULT
](
js-apis-bundleManager.md
)
获取
应用程序信息,未做特殊说明的属性,
可以通过
[
getBundleInfo
](
js-apis-bundleManager.md#bundlemanagergetbundleinfo
)
获取,flag使用
[
GET_BUNDLE_INFO_WITH_APPLICATION
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md#bundleflag
)
。
## ApplicationInfo
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-bundleInfo.md
浏览文件 @
4d9695f4
...
...
@@ -3,7 +3,7 @@
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
应用包的信息,未做特殊说明的属性,
均通过
[
GET_BUNDLE_INFO_DEFAULT
](
js-apis-bundle-bundleManager
)
获取。
应用包的信息,未做特殊说明的属性,
可以通过
[
getBundleInfo
](
js-apis-bundleManager.md#bundlemanagergetbundleinfo
)
获取。
## BundleInfo
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-hapModuleInfo.md
浏览文件 @
4d9695f4
...
...
@@ -3,6 +3,8 @@
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
HAP信息,未做特殊说明的属性,可以通过
[
getBundleInfo
](
js-apis-bundleManager.md#bundlemanagergetbundleinfo
)
获取,flag使用
[
GET_BUNDLE_INFO_WITH_HAP_MODULE
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/apis/js-apis-bundleManager.md#bundleflag
)
。
## HapModuleInfo
**系统能力**
: SystemCapability.BundleManager.BundleFramework.Core
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-launcherAbilityInfo.md
浏览文件 @
4d9695f4
...
...
@@ -2,6 +2,8 @@
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
桌面应用的Ability信息,可以通过
[
getLauncherAbilityInfo
](
js-apis-launcherBundleManager.md#launcherbundlemanagergetlauncherabilityinfo9
)
获取。
## LauncherAbilityInfo
**系统能力:**
SystemCapability.BundleManager.BundleFramework.Launcher。
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-metadata.md
浏览文件 @
4d9695f4
...
...
@@ -3,7 +3,10 @@
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
描述的module、ability、extensionAbility配置信息,标签值为数组类型,该标签下的配置只对当前module、或者ability、或者extensionAbility生效。
可以通过
[
getBundleInfo
](
js-apis-bundleManager.md#bundlemanagergetbundleinfo
)
获取,此对象在
[
ApplicationInfo
](
js-apis-bundleManager-applicationInfo.md
)
、
[
HapModuleInfo
](
js-apis-bundleManager-hapModuleInfo.md
)
、
[
AbilityInfo
](
js-apis-bundleManager-abilityInfo.md
)
、
[
ExtensionAbilityInfo
](
js-apis-bundleManager-extensionAbilityInfo.md
)
中均包含。
## Metadata
**系统能力**
: SystemCapability.BundleManager.BundleFramework.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | ------ | ---- | ---- | ---------- |
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager-shortcutInfo.md
浏览文件 @
4d9695f4
...
...
@@ -3,7 +3,7 @@
> **说明:**
> 本模块首批接口从API version 9 开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
本应用配置文件中定义的快捷方式信息,FA模型配置在
[
config.json文件中进行配置
](
../../quick-start/module-structure.md#%E8%A1%A817-shortcuts%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E
)
,Stage模型配置参考
[
shortcuts对象内部结构
](
../../quick-start/module-configuration-file.md#shortcuts标签
)
。
本应用配置文件中定义的快捷方式信息,
可以通过
[
getShortcutInfo
](
js-apis-launcherBundleManager.md#launcherbundlemanagergetshortcutinfo9
)
获取,
FA模型配置在
[
config.json文件中进行配置
](
../../quick-start/module-structure.md#%E8%A1%A817-shortcuts%E5%AF%B9%E8%B1%A1%E7%9A%84%E5%86%85%E9%83%A8%E7%BB%93%E6%9E%84%E8%AF%B4%E6%98%8E
)
,Stage模型配置参考
[
shortcuts对象内部结构
](
../../quick-start/module-configuration-file.md#shortcuts标签
)
。
## ShortcutWant
...
...
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationExtraParams.md
浏览文件 @
4d9695f4
# ContinuationExtraParams
本模块提供流转管理入口中设备选择模块所需的过滤参数。
本模块提供流转管理入口中设备选择模块所需的过滤参数
,可以作为
[
startContinuationDeviceManager
](
js-apis-continuation-continuationManager.md#continuationmanagerstartcontinuationdevicemanager9
)
的入参
。
> **说明:**
>
...
...
zh-cn/application-dev/reference/apis/js-apis-continuation-continuationResult.md
浏览文件 @
4d9695f4
...
...
@@ -5,7 +5,7 @@
## ContinuationResult
表示流转管理入口返回的设备信息。
ContinuationManager的
[
on
](
js-apis-continuation-continuationManager.md#continuationmanagerstartcontinuationdevicemanager9
)
接口返回此对象
表示流转管理入口返回的设备信息。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.DistributedAbilityManager
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-abilityResult.md
浏览文件 @
4d9695f4
# AbilityResult
定义
ability拉起、销毁之后返回的结果码和数据
。
定义
Ability拉起、销毁之后返回的结果码和数据,可以通过
[
startAbilityForResult
](
js-apis-ability-context.md#abilitycontextstartabilityforresult
)
获取对端Ability销毁后返回的AbilityResult对象,被startAbilityForResult拉起的Ability对象可以通过
[
terminateSelfWithResult
](
js-apis-ability-context.md#abilitycontextterminateselfwithresult
)
返回AbilityResult对象
。
> **说明:**
>
...
...
@@ -13,14 +13,3 @@
| resultCode | 是 | 否 | number | 否 | 表示ability拉起、销毁之后返回的结果码。 |
| want | 是 | 否 |
[
Want
](
./js-apis-app-ability-want.md
)
| 否 | 表示ability销毁之后返回的数据。 |
**示例:**
```
ts
let
want
=
{
bundleName
:
'
com.example.mydocapplication
'
,
abilityName
:
'
MainAbility
'
,
};
this
.
context
.
startAbilityForResult
(
want
,
(
error
,
data
)
=>
{
let
resultCode
=
data
.
resultCode
;
let
want
=
data
.
want
;
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-ability-connectOptions.md
浏览文件 @
4d9695f4
# ConnectOptions
ConnectOptions类型说明
在连接指定的后台服务时作为入参用于接收连接过程中的状态变化,如作为
[
connectServiceExtensionAbility
](
js-apis-inner-application-serviceExtensionContext.md#serviceextensioncontextconnectserviceextensionability
)
的入参连接指定的ServiceExtensionAbility。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 参数名 | 类型 | 必填 | 说明 |
| ------------ | -------- | ---- | ------------------------- |
| onConnect
<sup>
7+
</sup>
| function | 是 |
连接成功时的回调函数。
|
| onDisconnect
<sup>
7+
</sup>
| function | 是 |
连接失败时的回调函数。
|
| onFailed
<sup>
7+
</sup>
| function | 是 |
ConnectAbility调用
失败时的回调函数。 |
| onConnect
<sup>
7+
</sup>
| function | 是 |
建立连接时的回调函数。
|
| onDisconnect
<sup>
7+
</sup>
| function | 是 |
断开连接时的回调函数。
|
| onFailed
<sup>
7+
</sup>
| function | 是 |
连接
失败时的回调函数。 |
**返回值:**
| 类型 | 说明 |
| ------ | -------------------- |
| number | 连接的ServiceAbilityID。 |
**示例:**
```
ts
import
rpc
from
'
@ohos.rpc
'
;
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
function
onConnectCallback
(
element
,
remote
){
console
.
log
(
'
ConnectAbility onConnect remote is proxy:
'
+
(
remote
instanceof
rpc
.
RemoteProxy
));
}
function
onDisconnectCallback
(
element
){
console
.
log
(
'
ConnectAbility onDisconnect element.deviceId :
'
+
element
.
deviceId
)
}
function
onFailedCallback
(
code
){
console
.
log
(
'
featureAbilityTest ConnectAbility onFailed errCode :
'
+
code
)
}
var
connectId
=
featureAbility
.
connectAbility
(
{
deviceId
:
""
,
bundleName
:
"
com.ix.ServiceAbility
"
,
abilityName
:
"
ServiceAbilityA
"
,
},
{
onConnect
:
onConnectCallback
,
onDisconnect
:
onDisconnectCallback
,
onFailed
:
onFailedCallback
,
},
);
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityHelper.md
浏览文件 @
4d9695f4
# DataAbilityHelper
可以通过
[
acquireDataAbilityHelper
](
js-apis-ability-featureAbility.md#featureabilityacquiredataabilityhelper7
)
接口获取DataAbilityHelper对象。
> **说明:**
>
> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...
...
@@ -37,11 +39,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"
dataability:///com.example.DataAbility
"
);
var
mode
=
"
rwt
"
;
DAHelper
.
openFile
(
"
dataability:///com.example.DataAbility
"
,
mode
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
openFile
(
"
dataability:///com.example.DataAbility
"
,
mode
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -74,10 +73,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"
dataability:///com.example.DataAbility
"
);
var
mode
=
"
rwt
"
;
DAHelper
.
openFile
(
"
dataability:///com.example.DataAbility
"
,
mode
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>openFileCallback=======================>
"
);
DAHelper
.
openFile
(
"
dataability:///com.example.DataAbility
"
,
mode
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>openFileCallback=======================>
"
);
});
```
...
...
@@ -173,10 +170,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
getType
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
getType
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -207,10 +202,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
getType
(
"
dataability:///com.example.DataAbility
"
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>getTypeCallback=======================>
"
);
DAHelper
.
getType
(
"
dataability:///com.example.DataAbility
"
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>getTypeCallback=======================>
"
);
});
```
...
...
@@ -237,11 +230,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
getFileTypes
(
"
dataability:///com.example.DataAbility
"
,
"
image/*
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
getFileTypes
(
"
dataability:///com.example.DataAbility
"
,
"
image/*
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -275,11 +266,9 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
getFileTypes
(
"
dataability:///com.example.DataAbility
"
,
"
image/*
"
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>getFileTypesCallback=======================>
"
);
DAHelper
.
getFileTypes
(
"
dataability:///com.example.DataAbility
"
,
"
image/*
"
).
then
((
data
)
=>
{
console
.
info
(
"
===================>getFileTypesCallback================>
"
);
});
```
...
...
@@ -305,10 +294,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
normalizeUri
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
normalizeUri
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -339,10 +326,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
normalizeUri
(
"
dataability:///com.example.DataAbility
"
,
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>normalizeUriCallback=======================>
"
);
DAHelper
.
normalizeUri
(
"
dataability:///com.example.DataAbility
"
,).
then
((
data
)
=>
{
console
.
info
(
"
=================>normalizeUriCallback=======================>
"
);
});
```
...
...
@@ -368,10 +353,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
denormalizeUri
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
denormalizeUri
(
"
dataability:///com.example.DataAbility
"
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -404,10 +387,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
denormalizeUri
(
"
dataability:///com.example.DataAbility
"
,
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>denormalizeUriCallback=======================>
"
);
DAHelper
.
denormalizeUri
(
"
dataability:///com.example.DataAbility
"
,).
then
((
data
)
=>
{
console
.
info
(
"
===============>denormalizeUriCallback=======================>
"
);
});
```
...
...
@@ -433,10 +414,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
helper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
helper
.
notifyChange
(
"
dataability:///com.example.DataAbility
"
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
helper
.
notifyChange
(
"
dataability:///com.example.DataAbility
"
,
(
err
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -467,10 +446,8 @@ import featureAbility from '@ohos.ability.featureAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
DAHelper
.
notifyChange
(
"
dataability:///com.example.DataAbility
"
,
).
then
(()
=>
{
console
.
info
(
"
==========================>notifyChangeCallback=======================>
"
);
DAHelper
.
notifyChange
(
"
dataability:///com.example.DataAbility
"
).
then
(()
=>
{
console
.
info
(
"
================>notifyChangeCallback================>
"
);
});
```
...
...
@@ -503,11 +480,9 @@ const valueBucket = {
"
salary
"
:
200.5
,
"
blobType
"
:
"
u8
"
,
}
DAHelper
.
insert
(
"
dataability:///com.example.DataAbility
"
,
valueBucket
,
DAHelper
.
insert
(
"
dataability:///com.example.DataAbility
"
,
valueBucket
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -545,11 +520,8 @@ const valueBucket = {
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,
}
DAHelper
.
insert
(
"
dataability:///com.example.DataAbility
"
,
valueBucket
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>insertCallback=======================>
"
);
DAHelper
.
insert
(
"
dataability:///com.example.DataAbility
"
,
valueBucket
).
then
((
data
)
=>
{
console
.
info
(
"
====================>insertCallback=======================>
"
);
});
```
...
...
@@ -579,11 +551,9 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
var
cars
=
new
Array
({
"
name
"
:
"
roe11
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,},
{
"
name
"
:
"
roe12
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,})
DAHelper
.
batchInsert
(
"
dataability:///com.example.DataAbility
"
,
cars
,
DAHelper
.
batchInsert
(
"
dataability:///com.example.DataAbility
"
,
cars
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -618,11 +588,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
var
cars
=
new
Array
({
"
name
"
:
"
roe11
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,},
{
"
name
"
:
"
roe12
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,},
{
"
name
"
:
"
roe13
"
,
"
age
"
:
21
,
"
salary
"
:
20.5
,
"
blobType
"
:
"
u8
"
,})
DAHelper
.
batchInsert
(
"
dataability:///com.example.DataAbility
"
,
cars
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>batchInsertCallback=======================>
"
);
DAHelper
.
batchInsert
(
"
dataability:///com.example.DataAbility
"
,
cars
).
then
((
data
)
=>
{
console
.
info
(
"
==================>batchInsertCallback=======================>
"
);
});
```
...
...
@@ -651,11 +618,9 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"
dataability:///com.example.DataAbility
"
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
delete
(
"
dataability:///com.example.DataAbility
"
,
da
,
DAHelper
.
delete
(
"
dataability:///com.example.DataAbility
"
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -689,11 +654,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
"
dataability:///com.example.DataAbility
"
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
delete
(
"
dataability:///com.example.DataAbility
"
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>deleteCallback=======================>
"
);
DAHelper
.
delete
(
"
dataability:///com.example.DataAbility
"
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>deleteCallback=======================>
"
);
});
```
...
...
@@ -729,12 +691,8 @@ const va = {
"
blobType
"
:
"
u8
"
,
}
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
update
(
"
dataability:///com.example.DataAbility
"
,
va
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
update
(
"
dataability:///com.example.DataAbility
"
,
va
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -775,12 +733,8 @@ const va = {
"
blobType
"
:
"
u8
"
,
}
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
update
(
"
dataability:///com.example.DataAbility
"
,
va
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>updateCallback=======================>
"
);
DAHelper
.
update
(
"
dataability:///com.example.DataAbility
"
,
va
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>updateCallback=======================>
"
);
});
```
...
...
@@ -811,12 +765,8 @@ var DAHelper = featureAbility.acquireDataAbilityHelper(
);
var
cars
=
new
Array
(
"
value1
"
,
"
value2
"
,
"
value3
"
,
"
value4
"
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
query
(
"
dataability:///com.example.DataAbility
"
,
cars
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
DAHelper
.
query
(
"
dataability:///com.example.DataAbility
"
,
cars
,
da
,
(
err
,
data
)
=>
{
console
.
info
(
"
==========================>Called=======================>
"
);
});
```
...
...
@@ -852,14 +802,10 @@ import ohos_data_ability from '@ohos.data.dataAbility'
var
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.DataAbility
"
);
var
cars
=
new
Array
(
"
value1
"
,
"
value2
"
,
"
value3
"
,
"
value4
"
);
var
cars
=
new
Array
(
"
value1
"
,
"
value2
"
,
"
value3
"
,
"
value4
"
);
let
da
=
new
ohos_data_ability
.
DataAbilityPredicates
()
DAHelper
.
query
(
"
dataability:///com.example.DataAbility
"
,
cars
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>queryCallback=======================>
"
);
DAHelper
.
query
(
"
dataability:///com.example.DataAbility
"
,
cars
,
da
).
then
((
data
)
=>
{
console
.
info
(
"
==========================>queryCallback=======================>
"
);
});
```
...
...
@@ -891,8 +837,10 @@ call(uri: string, method: string, arg: string, extras: PacMap): Promise\<PacMap>
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
call
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
"
method
"
,
"
arg
"
,
{
"
key1
"
:
"
value1
"
}).
then
((
data
)
=>
{
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
call
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
"
method
"
,
"
arg
"
,
{
"
key1
"
:
"
value1
"
}).
then
((
data
)
=>
{
console
.
info
(
'
Operation succeeded:
'
+
data
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
error
);
...
...
@@ -922,8 +870,10 @@ call(uri: string, method: string, arg: string, extras: PacMap, callback: AsyncCa
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
call
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
"
method
"
,
"
arg
"
,
{
"
key1
"
:
"
value1
"
},
(
err
,
data
)
=>
{
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
call
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
"
method
"
,
"
arg
"
,
{
"
key1
"
:
"
value1
"
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
err
);
return
;
...
...
@@ -955,8 +905,10 @@ import featureAbility from '@ohos.ability.featureAbility';
// 根据DataAbilityOperation列表选择要对数据库做的操作
let
op
=
new
Array
();
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
executeBatch
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
op
,
(
err
,
data
)
=>
{
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
executeBatch
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
op
,
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Operation failed. Cause:
'
+
err
);
return
;
...
...
@@ -993,8 +945,10 @@ import featureAbility from '@ohos.ability.featureAbility';
// 根据DataAbilityOperation列表选择要对数据库做的操作
let
op
=
new
Array
();
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
executeBatch
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
op
).
then
((
data
)
=>
{
let
dataAbilityHelper
=
featureAbility
.
acquireDataAbilityHelper
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
);
dataAbilityHelper
.
executeBatch
(
"
dataability:///com.example.jsapidemo.UserDataAbility
"
,
op
).
then
((
data
)
=>
{
console
.
info
(
'
Operation succeeded:
'
+
data
);
}).
catch
((
error
)
=>
{
console
.
error
(
'
Operation failed. Cause:
'
+
error
);
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityOperation.md
浏览文件 @
4d9695f4
# DataAbilityOperation
定义dataAbility数据操作方式。
定义dataAbility数据操作方式
,可以作为
[
executeBatch
](
js-apis-inner-ability-dataAbilityHelper.md#dataabilityhelperexecutebatch
)
的入参查询数据库的信息
。
> **说明:**
>
...
...
@@ -11,56 +11,11 @@
| 名称 | 类型 | 必填| 说明 |
| -------- | -------- | --------| -------- |
| uri | string | 是 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 |
| type | featureAbility.DataAbilityOperationType | 是 | 指示操作类型。 |
| valuesBucket? | rdb.ValuesBucket | 否 | 指示要设置的数据值。 |
| valueBackReferences? | rdb.ValuesBucket | 否 | 指示包含一组键值对的valuesBucket对象。 |
| predicates? | dataAbility.DataAbilityPredicates | 否 | 指示要设置的筛选条件。如果此参数为空,则所有数据记录。 |
| predicatesBackReferences? | Map
\<
number, number> | 否 | 指示用作谓词中筛选条件的反向引用。 |
| interrupted? | boolean | 否 | 指定是否可以中断批处理操作。 |
| expectedCount? | number | 否 | 指示要更新或删除的预期行数。 |
**示例:**
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
let
dataAbilityUri
=
(
"
dataability:///com.example.myapplication.TestDataAbility
"
);
let
DAHelper
;
try
{
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
if
(
DAHelper
==
null
){
console
.
error
(
'
DAHelper is null
'
);
return
;
}
}
catch
(
err
)
{
console
.
error
(
'
acquireDataAbilityHelper fail, error:
'
+
JSON
.
stringify
(
err
));
return
;
}
let
valueBucket
=
{
"
name
"
:
"
DataAbilityHelperTest
"
,
"
age
"
:
24
,
"
salary
"
:
2024.20
,
};
let
dataAbilityOperation
=
{
uri
:
dataAbilityUri
,
type
:
featureAbility
.
DataAbilityOperationType
.
TYPE_INSERT
,
valuesBucket
:
valueBucket
,
predicates
:
null
,
expectedCount
:
1
,
PredicatesBackReferences
:
{},
interrupted
:
true
}
let
operations
=
[
dataAbilityOperation
];
try
{
DAHelper
.
executeBatch
(
dataAbilityUri
,
operations
,
(
err
,
data
)
=>
{
console
.
log
(
"
executeBatch, data:
"
+
JSON
.
stringify
(
data
));
}
);
}
catch
(
err
)
{
console
.
error
(
'
executeBatch fail:
'
+
JSON
.
stringify
(
err
));
}
```
\ No newline at end of file
| uri | string | 是 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 |
| type | featureAbility.DataAbilityOperationType | 是 | 指示操作类型。 |
| valuesBucket? | rdb.ValuesBucket | 否 | 指示要设置的数据值。 |
| valueBackReferences? | rdb.ValuesBucket | 否 | 指示包含一组键值对的valuesBucket对象。 |
| predicates? | dataAbility.DataAbilityPredicates | 否 | 指示要设置的筛选条件。如果此参数为空,则所有数据记录。 |
| predicatesBackReferences? | Map
\<
number, number> | 否 | 指示用作谓词中筛选条件的反向引用。 |
| interrupted? | boolean | 否 | 指定是否可以中断批处理操作。 |
| expectedCount? | number | 否 | 指示要更新或删除的预期行数。 |
zh-cn/application-dev/reference/apis/js-apis-inner-ability-dataAbilityResult.md
浏览文件 @
4d9695f4
# DataAbilityResult
定义dataAbility数据操作结果。
定义dataAbility数据操作结果
,通过
[
executeBatch
](
js-apis-inner-ability-dataAbilityHelper.md#dataabilityhelperexecutebatch
)
查询数据库信息时查询结果通过DataAbilityResult对象返回
。
> **说明:**
>
...
...
@@ -11,10 +11,11 @@
| 名称 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| uri? | string | 否 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 |
| count? | number | 否 | 指示受操作影响的行数。 |
| uri? | string | 否 | 指定待处理的DataAbility。例:"dataability:///com.example.xxx.xxxx"。 |
| count? | number | 否 | 指示受操作影响的行数。 |
**示例:**
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
...
...
@@ -22,7 +23,7 @@ let dataAbilityUri = ("dataability:///com.example.myapplication.TestDataAbility"
let
DAHelper
;
try
{
DAHelper
=
featureAbility
.
acquireDataAbilityHelper
(
dataAbilityUri
);
if
(
DAHelper
==
null
)
{
if
(
DAHelper
==
null
)
{
console
.
error
(
'
DAHelper is null
'
);
return
;
}
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-startAbilityParameter.md
浏览文件 @
4d9695f4
# StartAbilityParameter
定义启动Ability参数。
定义启动Ability参数
,可以作为入参调用
[
startAbility
](
js-apis-ability-featureAbility.md#featureabilitystartability
)
启动指定的Ability
。
> **说明:**
>
...
...
@@ -31,11 +31,11 @@ let abilityStartSetting ={
}
let
startAbilityParameter
=
{
want
:
Want
,
abilityStartSetting
:
abilityStartSetting
want
:
Want
,
abilityStartSetting
:
abilityStartSetting
}
featureAbility
.
startAbility
(
startAbilityParameter
,
(
err
,
data
)
=>
{
featureAbility
.
startAbility
(
startAbilityParameter
,
(
err
,
data
)
=>
{
console
.
log
(
'
errCode :
'
+
JSON
.
stringify
(
err
));
console
.
log
(
'
data :
'
+
JSON
.
stringify
(
data
));
}
catch
(
error
)
{
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-ability-want.md
浏览文件 @
4d9695f4
# Want
Want是对象间信息传递的载体, 可以用于应用组件间的信息传递。 Want的使用场景之一是作为
startAbility
的参数, 其包含了指定的启动目标, 以及启动时需携带的相关数据, 如bundleName和abilityName字段分别指明目标Ability所在应用的包名以及对应包内的Ability名称。当Ability A需要启动Ability B并传入一些数据时, 可使用Want作为载体将这些数据传递给Ability B。
Want是对象间信息传递的载体, 可以用于应用组件间的信息传递。 Want的使用场景之一是作为
[
startAbility
](
js-apis-inner-application-uiAbilityContext.md#uiabilitycontextstartability
)
的参数, 其包含了指定的启动目标, 以及启动时需携带的相关数据, 如bundleName和abilityName字段分别指明目标Ability所在应用的包名以及对应包内的Ability名称。当Ability A需要启动Ability B并传入一些数据时, 可使用Want作为载体将这些数据传递给Ability B。
> **说明:**
>
...
...
@@ -23,43 +23,46 @@ Want是对象间信息传递的载体, 可以用于应用组件间的信息传
**示例:**
-
基础用法
-
基础用法
(在UIAbility对象中调用,其中示例中的context为UIAbility的上下文对象)
```
ts
var
want
=
{
"
deviceId
"
:
""
,
// deviceId为空表示本设备
"
bundleName
"
:
"
com.extreme.test
"
,
"
abilityName
"
:
"
MainAbility
"
,
"
moduleName
"
:
"
entry
"
// moduleName非必选
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
"
error.code =
"
+
error
.
code
)
})
let
want
=
{
"
deviceId
"
:
""
,
// deviceId为空表示本设备
"
bundleName
"
:
"
com.extreme.test
"
,
"
abilityName
"
:
"
MainAbility
"
,
"
moduleName
"
:
"
entry
"
// moduleName非必选
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
"
error.code =
"
+
error
.
code
)
})
```
-
传递FD
数据,FD表示文件描述符(FileDescriptor
)
-
传递FD
(文件描述符)数据(在UIAbility对象中调用,其中示例中的context为UIAbility的上下文对象
)
```
ts
import
fileio
from
'
@ohos.fileio
'
;
var
fd
;
try
{
fd
=
fileio
.
openSync
(
"
/data/storage/el2/base/haps/pic.png
"
);
}
catch
(
e
)
{
console
.
log
(
"
openSync fail:
"
+
JSON
.
stringify
(
e
));
}
var
want
=
{
"
deviceId
"
:
""
,
// deviceId为空表示本设备
"
bundleName
"
:
"
com.extreme.test
"
,
"
abilityName
"
:
"
MainAbility
"
,
"
moduleName
"
:
"
entry
"
,
// moduleName非必选
"
parameters
"
:
{
"
keyFd
"
:{
"
type
"
:
"
FD
"
,
"
value
"
:
fd
}
}
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
"
error.code =
"
+
error
.
code
)
})
import
fileio
from
'
@ohos.fileio
'
;
// ...
let
fd
;
try
{
fd
=
fileio
.
openSync
(
"
/data/storage/el2/base/haps/pic.png
"
);
}
catch
(
e
)
{
console
.
log
(
"
openSync fail:
"
+
JSON
.
stringify
(
e
));
}
let
want
=
{
"
deviceId
"
:
""
,
// deviceId为空表示本设备
"
bundleName
"
:
"
com.extreme.test
"
,
"
abilityName
"
:
"
MainAbility
"
,
"
moduleName
"
:
"
entry
"
,
// moduleName非必选
"
parameters
"
:
{
"
keyFd
"
:{
"
type
"
:
"
FD
"
,
"
value
"
:
fd
}
}
};
this
.
context
.
startAbility
(
want
,
(
error
)
=>
{
// 显式拉起Ability,通过bundleName、abilityName和moduleName可以唯一确定一个Ability
console
.
log
(
"
error.code =
"
+
error
.
code
)
})
// ...
```
<!--no_check-->
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-app-appVersionInfo.md
浏览文件 @
4d9695f4
# AppVersionInfo
定义应用版本信息。
定义应用版本信息
,可以通过
[
getAppVersionInfo
](
js-apis-inner-app-context.md#contextgetappversioninfo7
)
获取当前应用的版本信息
。
> **说明:**
>
...
...
@@ -14,15 +14,3 @@
| versionCode | number | 是 | 否 | 模块描述信息。 |
| versionName | string | 是 | 否 | 描述信息ID。 |
**示例:**
```
ts
let
appName
;
let
versionCode
;
let
versionName
;
this
.
context
.
getAppVersionInfo
((
error
,
data
)
=>
{
console
.
info
(
'
getAppVersionInfo data is:
'
+
JSON
.
stringify
(
data
));
appName
=
data
.
appName
;
versionCode
=
data
.
versionCode
;
versionName
=
data
.
versionName
;
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-app-context.md
浏览文件 @
4d9695f4
...
...
@@ -9,7 +9,7 @@ Context模块提供了ability或application的上下文的能力,包括允许
## 使用说明
Context对象是在featureAbility中创建实例,并通过featureAbility的
getContext(
)接口返回,因此在使用Context时,必须导入@ohos.ability.featureAbility库。示例如下:
Context对象是在featureAbility中创建实例,并通过featureAbility的
[
getContext
](
js-apis-ability-featureAbility.md#featureabilitygetcontext
)
接口返回,因此在使用Context时,必须导入@ohos.ability.featureAbility库。示例如下:
```
ts
import
featureAbility
from
'
@ohos.ability.featureAbility
'
;
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-app-processInfo.md
浏览文件 @
4d9695f4
# ProcessInfo
定义进程信息。
定义进程信息
,可以通过
[
getProcessInfo
](
js-apis-inner-app-context.md#contextgetprocessinfo7
)
获取当前Ability运行的进程信息
。
> **说明:**
>
...
...
@@ -8,10 +8,10 @@
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| pid | number | 是 | 否 | 进程ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| pid | number | 是 | 否 | 进程ID。 |
| processName | string | 是 | 否 | 进程名称。 |
**示例:**
```
ts
...
...
@@ -24,3 +24,4 @@ context.getProcessInfo((err, data) => {
let
processName
=
data
.
processName
;
});
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegator.md
浏览文件 @
4d9695f4
...
...
@@ -8,14 +8,11 @@ AbilityDelegator提供添加用于监视指定ability的生命周期状态更改
## 使用说明
通过AbilityDelegatorRegistry中
getAbilityDelegator
方法获取。
通过AbilityDelegatorRegistry中
[
getAbilityDelegator
](
js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetabilitydelegator
)
方法获取。
```
ts
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
```
## AbilityDelegator
...
...
@@ -1044,7 +1041,7 @@ abilityDelegator.waitAbilityStageMonitor(monitor, (err : any, data : any) => {
console
.
info
(
"
waitAbilityStageMonitor callback
"
);
});
```
### waitAbilityStageMonitor<sup>9+</sup>
waitAbilityStageMonitor(monitor: AbilityStageMonitor, timeout?: number): Promise
\<
AbilityStage>;
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityDelegatorArgs.md
浏览文件 @
4d9695f4
...
...
@@ -8,7 +8,7 @@ AbilityDelegatorArgs模块提供在应用程序启动期间,用于存储已注
## 使用说明
通过AbilityDelegatorRegistry中
getArguments
方法获取。
通过AbilityDelegatorRegistry中
[
getArguments
](
js-apis-app-ability-abilityDelegatorRegistry.md#abilitydelegatorregistrygetarguments
)
方法获取。
## AbilityDelegatorArgs
...
...
@@ -30,5 +30,3 @@ import AbilityDelegatorRegistry from '@ohos.application.abilityDelegatorRegistry
var
args
=
AbilityDelegatorRegistry
.
getArguments
();
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityMonitor.md
浏览文件 @
4d9695f4
...
...
@@ -8,7 +8,7 @@ AbilityMonitor模块提供匹配满足指定条件的受监视能力对象的方
## 使用说明
通过abilityDelegator中的addAbilityMonitor来设置
。
可以作为abilityDelegator中的
[
addAbilityMonitor
](
js-apis-inner-application-abilityDelegator.md#addabilitymonitor9
)
的入参来监听指定Ability的生命周期变化
。
## AbilityMonitor
...
...
@@ -31,7 +31,6 @@ Ability监听器
```
ts
import
AbilityDelegatorRegistry
from
'
@ohos.application.abilityDelegatorRegistry
'
var
abilityDelegator
;
function
onAbilityCreateCallback
(
data
)
{
console
.
info
(
"
onAbilityCreateCallback
"
);
...
...
@@ -42,7 +41,7 @@ var monitor = {
onAbilityCreate
:
onAbilityCreateCallback
}
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
var
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
abilityDelegator
.
addAbilityMonitor
(
monitor
,
(
err
:
any
)
=>
{
console
.
info
(
"
addAbilityMonitor callback
"
);
});
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityRunningInfo.md
浏览文件 @
4d9695f4
...
...
@@ -8,7 +8,7 @@ AbilityRunningInfo模块提供对Ability运行的相关信息和状态的定义
## 使用说明
通过abilityManager中
getAbilityRunningInfos
方法获取。
通过abilityManager中
[
getAbilityRunningInfos
](
js-apis-app-ability-abilityManager.md#getabilityrunninginfos
)
方法获取。
## 属性
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-abilityStateData.md
浏览文件 @
4d9695f4
# AbilityStateData
定义Ability状态信息。
定义Ability状态信息
,可以通过
[
registerApplicationStateObserver
](
js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8
)
注册生命周期变化监听后,通过
[
ApplicationStateObserver
](
js-apis-inner-application-applicationStateObserver.md
)
的onAbilityStateChanged生命周期回调获取
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -12,22 +12,5 @@
| uid
<sup>
8+
</sup>
| number | 是 | 否 | 用户ID。 |
| state
<sup>
8+
</sup>
| number | 是 | 否 | Ability状态。 |
| moduleName
<sup>
9+
</sup>
| string | 是 | 否 | Ability所属的HAP包的名称。 |
| abilityType
<sup>
8+
</sup>
| string | 是 | 否 |
能力类型、页面或服务等。
|
| abilityType
<sup>
8+
</sup>
| string | 是 | 否 |
Ability类型:页面或服务等。
|
**示例:**
```
ts
import
appManager
from
"
@ohos.application.appManager
"
appManager
.
getForegroundApplications
((
error
,
data
)
=>
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
let
appStateData
=
data
[
i
];
console
.
info
(
'
appStateData.pid:
'
+
appStateData
.
pid
);
console
.
info
(
'
appStateData.bundleName:
'
+
appStateData
.
bundleName
);
console
.
info
(
'
appStateData.abilityName:
'
+
appStateData
.
abilityName
);
console
.
info
(
'
appStateData.uid:
'
+
appStateData
.
uid
);
console
.
info
(
'
appStateData.state:
'
+
appStateData
.
state
);
console
.
info
(
'
appStateData.moduleName:
'
+
appStateData
.
moduleName
);
console
.
info
(
'
appStateData.abilityType:
'
+
appStateData
.
abilityType
);
}
});
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-application-appStateData.md
浏览文件 @
4d9695f4
# AppStateData
定义应用状态信息。
定义应用状态信息
,可以通过
[
getForegroundApplications
](
js-apis-app-ability-appManager.md#appmanagergetforegroundapplications
)
获取当前应用的相关信息
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -17,11 +17,12 @@
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
);
console
.
info
(
'
appStateData.state:
'
+
appStateData
.
state
);
}
});
```
\ No newline at end of file
```
zh-cn/application-dev/reference/apis/js-apis-inner-application-applicationStateObserver.md
浏览文件 @
4d9695f4
# ApplicationStateObserver
定义应用状态监听。
定义应用状态监听
,可以作为
[
registerApplicationStateObserver
](
js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8
)
的入参监听当前应用的生命周期变化
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
**系统API**
:该接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
| onForegroundApplicationChanged
<sup>
8+
</sup>
| AsyncCallback
\<
void> | 是 | 否 | 应用前后台状态发生变化时执行的回调函数。 |
| onAbilityStateChanged
<sup>
8+
</sup>
| AsyncCallback
\<
void> | 是 | 否 | ability状态发生变化时执行的回调函数。 |
| onProcessCreated
<sup>
8+
</sup>
| AsyncCallback
\<
void> | 是 | 否 | 进程创建时执行的回调函数。 |
| onProcessDied
<sup>
8+
</sup>
| AsyncCallback
\<
void> | 是 | 否 | 进程销毁时执行的回调函数。 |
| onProcessStateChanged
<sup>
8+
</sup>
| AsyncCallback
\<
void> | 是 | 否 | 进程状态更新时执行的回调函数。 |
| 名称 |
|
类型 | 可读 | 可写 | 说明 |
| ----------------------- | ---------| ---- | ---- | ------------------------- |
------------------------- |
| onForegroundApplicationChanged
<sup>
8+
</sup>
|
[
AppStateData
](
js-apis-inner-application-appStateData.md
)
|
AsyncCallback
\<
void> | 是 | 否 | 应用前后台状态发生变化时执行的回调函数。 |
| onAbilityStateChanged
<sup>
8+
</sup>
|
[
AbilityStateData
](
js-apis-inner-application-abilityStateData.md
)
|
AsyncCallback
\<
void> | 是 | 否 | ability状态发生变化时执行的回调函数。 |
| onProcessCreated
<sup>
8+
</sup>
|
[
ProcessData
](
js-apis-inner-application-processData.md
)
|
AsyncCallback
\<
void> | 是 | 否 | 进程创建时执行的回调函数。 |
| onProcessDied
<sup>
8+
</sup>
|
[
ProcessData
](
js-apis-inner-application-processData.md
)
|
AsyncCallback
\<
void> | 是 | 否 | 进程销毁时执行的回调函数。 |
| onProcessStateChanged
<sup>
8+
</sup>
|
[
ProcessData
](
js-apis-inner-application-processData.md
)
|
AsyncCallback
\<
void> | 是 | 否 | 进程状态更新时执行的回调函数。 |
**示例:**
```
ts
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
浏览文件 @
4d9695f4
# Context模块
Context模块提供了ability或application的上下文的能力,包括允许访问特定于应用程序的资源
、请求和验证权限
等。
Context模块提供了ability或application的上下文的能力,包括允许访问特定于应用程序的资源等。
> **说明:**
>
...
...
@@ -13,8 +13,8 @@ Context模块提供了ability或application的上下文的能力,包括允许
| 名称 | 类型 | 可读 | 可写 | 说明 |
| ----------- | ------ | ---- | ---- | ------- |
| resourceManager | resmgr.
ResourceManager
| 是 | 否 | 资源管理对象。 |
| applicationInfo |
ApplicationInfo
| 是 | 否 | 当前应用程序的信息。 |
| resourceManager | resmgr.
[
ResourceManager
](
js-apis-resource-manager.md
)
| 是 | 否 | 资源管理对象。 |
| applicationInfo |
[
ApplicationInfo
](
js-apis-bundle-ApplicationInfo.md
)
| 是 | 否 | 当前应用程序的信息。 |
| cacheDir | string | 是 | 否 | 缓存目录。 |
| tempDir | string | 是 | 否 | 临时目录。 |
| filesDir | string | 是 | 否 | 文件目录。 |
...
...
@@ -129,7 +129,7 @@ let applicationContext = this.context.getApplicationContext();
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 值 | 说明 |
| 名称 | 值 | 说明 |
| -------- | -------- | -------- |
| EL1 | 0 | 设备级加密区
。 |
| EL2 | 1 | 用户
凭据加密区。 |
| EL1 | 0 | 设备级加密区
,设备开机后可访问的数据区。 |
| EL2 | 1 | 用户
级加密区,设备开机,首次输入密码后才能够访问的数据区。 |
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueCallback.md
浏览文件 @
4d9695f4
# ContinueCallback
表示迁移完成后,返回迁移结果回调函数。
表示迁移完成后,返回迁移结果回调函数
,可以作为
[
continueMission
](
js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission
)
的入参监听迁移回调
。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-continueDeviceInfo.md
浏览文件 @
4d9695f4
# ContinueDeviceInfo
表示发起任务迁移时所需参数的枚举。
表示发起任务迁移时所需参数的枚举
,可以作为
[
continueMission
](
js-apis-distributedMissionManager.md#distributedmissionmanagercontinuemission
)
的入参指定迁移相关参数
。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-errorObserver.md
浏览文件 @
4d9695f4
# ErrorObserver
定义异常监听。
定义异常监听
,可以作为
[
registerErrorObserver
](
js-apis-application-errorManager.md#errormanagerregistererrorobserver
)
的入参监听当前应用发生的异常
。
## onUnhandledException
...
...
@@ -11,13 +11,13 @@ onUnhandledException(errMsg: string): void;
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Core
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| errMsg | string | 否 | 有关异常的消息和错误堆栈跟踪。 |
**示例:**
```
ts
import
errorManager
from
'
@ohos.application.errorManager
'
;
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-extensionRunningInfo.md
浏览文件 @
4d9695f4
# ExtensionRunningInfo
ExtensionRunningInfo模块提供对Extension运行的相关信息和类型进行设置和查询的能力。
ExtensionRunningInfo模块提供对Extension运行的相关信息和类型进行设置和查询的能力
,可以通过
[
getExtensionRunningInfos
](
js-apis-app-ability-abilityManager.md#getextensionrunninginfos
)
获取
。
> **说明:**
>
...
...
@@ -28,10 +28,10 @@ ExtensionRunningInfo模块提供对Extension运行的相关信息和类型进行
**示例:**
```
ts
import
abilityManager
from
'
@ohos.application.abilityManager
'
;
let
upperLimit
=
1
;
let
upperLimit
=
1
;
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
err
,
data
)
=>
{
console
.
log
(
"
getExtensionRunningInfos err:
"
+
err
+
"
data:
"
+
JSON
.
stringify
(
data
));
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
for
(
let
i
=
0
;
i
<
data
.
length
;
i
++
)
{
let
extensionRunningInfo
=
data
[
i
];
console
.
log
(
"
extensionRunningInfo.extension:
"
+
JSON
.
stringify
(
extensionRunningInfo
.
extension
));
console
.
log
(
"
extensionRunningInfo.pid:
"
+
JSON
.
stringify
(
extensionRunningInfo
.
pid
));
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-formExtensionContext.md
浏览文件 @
4d9695f4
...
...
@@ -18,6 +18,8 @@ import FormExtensionAbility from '@ohos.app.form.FormExtensionAbility';
import
formBindingData
from
'
@ohos.app.form.formBindingData
'
;
export
default
class
MyFormExtensionAbility
extends
FormExtensionAbility
{
onAddForm
()
{
let
formContext
=
this
.
context
;
// 获取FormExtensionContext
// ...
let
dataObj1
=
{
temperature
:
"
11c
"
,
"
time
"
:
"
11:00
"
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionCallbacks.md
浏览文件 @
4d9695f4
# MissionCallbacks
表示开始同步后,建立的回调函数。
作为可以
[
registerMissionListener
](
js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener
)
的入参,
表示开始同步后,建立的回调函数。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
| 名称
| 类型 | 可读 | 可写 | 说明
|
| ---------------------
| -------- | ---- | ---- |
------------------ |
| notifyMissionsChanged
| function | 是 | 否 | 通知任务变化,返回设备ID。
|
| notifySnapshot
| function | 是 | 否 | 通知快照变化,返回设备ID,任务ID
|
| notifyNetDisconnect
| function | 是 | 否
| 通知断开连接,返回设备ID,网络状态 |
| 名称
| 类型 | 可读 | 可写 | 说明
|
| ---------------------
------------------------------- | -------- | ---- | ---- | ----------------
------------------ |
| notifyMissionsChanged
(deviceId: string) | function | 是 | 否 | 通知任务变化,返回设备ID。
|
| notifySnapshot
(deviceId: string, mission: number) | function | 是 | 否 | 通知快照变化,返回设备ID,任务ID
|
| notifyNetDisconnect
(deviceId: string, state: number) | function | 是 | 否
| 通知断开连接,返回设备ID,网络状态 |
**示例:**
```
ts
...
...
@@ -21,12 +21,12 @@ let missionCallback = {
notifyMissionsChanged
:
function
(
deviceId
)
{
console
.
log
(
"
notifyMissionsChanged deviceId:
"
+
JSON
.
stringify
(
deviceId
));
},
notifySnapshot
:
function
(
mission
,
deviceId
)
{
console
.
log
(
"
notifySnapshot mission:
"
+
JSON
.
stringify
(
mission
));
notifySnapshot
:
function
(
deviceId
,
mission
)
{
console
.
log
(
"
notifySnapshot deviceId:
"
+
JSON
.
stringify
(
deviceId
));
console
.
log
(
"
notifySnapshot mission:
"
+
JSON
.
stringify
(
mission
));
},
notifyNetDisconnect
:
function
(
mission
,
state
)
{
console
.
log
(
"
notifyNetDisconnect
mission:
"
+
JSON
.
stringify
(
mission
));
notifyNetDisconnect
:
function
(
deviceId
,
state
)
{
console
.
log
(
"
notifyNetDisconnect
deviceId:
"
+
JSON
.
stringify
(
deviceId
));
console
.
log
(
"
notifyNetDisconnect state:
"
+
JSON
.
stringify
(
state
));
}
};
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionDeviceInfo.md
浏览文件 @
4d9695f4
# MissionDeviceInfo
表示注册监听时所需参数的枚举。
作为可以
[
registerMissionListener
](
js-apis-distributedMissionManager.md#distributedmissionmanagerregistermissionlistener
)
的入参,
表示注册监听时所需参数的枚举。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionInfo.md
浏览文件 @
4d9695f4
# MissionInfo
表示Ability对应
任务信息的枚举
。
表示Ability对应
的任务信息,可以通过
[
getMissionInfo
](
js-apis-app-ability-missionManager.md#missionmanagergetmissioninfo
)
获取
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
**系统API**
: 此接口为系统接口,三方应用不支持调用。
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| missionId | number | 是 | 是 | 表示任务ID。|
| runningState | number | 是 | 是 | 表示运行状态。 |
| lockedState | boolean | 是 | 是 | 表示锁定状态。 |
| timestamp | string | 是 | 是 | 表示任务的最近创建或更新时间。 |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | 是 | 表示任务的Want信息。 |
| label | string | 是 | 是 | 表示任务的标签。 |
| iconPath | string | 是 | 是 | 表示任务的图标路径。 |
| continuable | boolean | 是 | 是 | 表示任务是否可以迁移。 |
| missionId | number | 是 | 是 | 表示任务ID。|
| runningState | number | 是 | 是 | 表示运行状态。 |
| lockedState | boolean | 是 | 是 | 表示锁定状态。 |
| timestamp | string | 是 | 是 | 表示任务的最近创建或更新时间。 |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | 是 | 表示任务的Want信息。 |
| label | string | 是 | 是 | 表示任务的标签。 |
| iconPath | string | 是 | 是 | 表示任务的图标路径。 |
| continuable | boolean | 是 | 是 | 表示任务是否可以迁移。 |
**示例:**
```
ts
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionListener.md
浏览文件 @
4d9695f4
# MissionListener
定义系统任务状态监听。
定义系统任务状态监听
,可以通过
[
registerMissionListener
](
js-apis-application-missionManager.md#missionmanagerregistermissionlistener
)
注册
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionParameter.md
浏览文件 @
4d9695f4
# MissionParameter
表示同步时所需参数的枚举。
作为
[
startSyncRemoteMissions
](
js-apis-distributedMissionManager.md#distributedmissionmanagerstartsyncremotemissions
)
的入参,
表示同步时所需参数的枚举。
**系统能力**
:SystemCapability.Ability.AbilityRuntime.Mission
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-missionSnapshot.md
浏览文件 @
4d9695f4
# MissionSnapshot
MissionSnapshot模块提供设置与任务对应的任务快照的任务元素名称的能力。
MissionSnapshot模块提供设置与任务对应的任务快照的任务元素名称的能力
,可以通过
[
getMissionSnapShot
](
js-apis-app-ability-missionManager.md#missionmanagergetmissionsnapshot
)
获取
。
> **说明:**
>
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-permissionRequestResult.md
浏览文件 @
4d9695f4
# PermissionRequestResult
PermissionRequestResult模块提供了权限请求结果的能力。
PermissionRequestResult模块提供了权限请求结果的能力
,在调用
[
requestPermissionsFromUser
](
js-apis-inner-application-uiAbilityContext.md#abilitycontextrequestpermissionsfromuser
)
申请权限时返回此对象表明此次权限申请的结果
。
> **说明:**
>
...
...
@@ -11,10 +11,10 @@ PermissionRequestResult模块提供了权限请求结果的能力。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| permissions | Array
<
string
>
| 是 | 否 | 用户传入的权限。|
| authResults | Array
<
number
>
| 是 | 否 | 相应请求权限的结果
。0表示授权成功,非0表示失败。 |
| permissions | Array
<
string
>
| 是 | 否 | 用户传入的权限。|
| authResults | Array
<
number
>
| 是 | 否 | 相应请求权限的结果
:0表示授权成功,非0表示失败。 |
## 使用说明
...
...
@@ -22,16 +22,16 @@ PermissionRequestResult模块提供了权限请求结果的能力。
**示例:**
```
ts
import
Ability
from
'
@ohos.application.
Ability
'
export
default
class
MainAbility
extends
Ability
{
import
UIAbility
from
'
@ohos.app.ability.UI
Ability
'
export
default
class
MainAbility
extends
UI
Ability
{
onWindowStageCreate
(
windowStage
)
{
var
permissions
=
[
'
com.example.permission
'
]
var
permissions
=
[
'
com.example.permission
'
]
var
permissionRequestResult
;
this
.
context
.
requestPermissionsFromUser
(
permissions
,
(
err
,
result
)
=>
{
if
(
err
)
{
this
.
context
.
requestPermissionsFromUser
(
permissions
,
(
err
,
result
)
=>
{
if
(
err
)
{
console
.
log
(
'
requestPermissionsFromUserError:
'
+
JSON
.
stringify
(
err
));
}
else
{
permissionRequestResult
=
result
;
}
else
{
permissionRequestResult
=
result
;
console
.
log
(
'
permissionRequestResult:
'
+
JSON
.
stringify
(
permissionRequestResult
));
}
});
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-processData.md
浏览文件 @
4d9695f4
# ProcessData
定义进程数据。
定义进程数据
,可以通过
[
registerApplicationStateObserver
](
js-apis-application-appManager.md#appmanagerregisterapplicationstateobserver8
)
注册生命周期变化监听后,通过
[
ApplicationStateObserver
](
js-apis-inner-application-applicationStateObserver.md
)
的onProcessCreated生命周期回调获取
。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInfo.md
浏览文件 @
4d9695f4
...
...
@@ -10,12 +10,12 @@
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Mission
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| bundleNames | Array
<
string
>
| 是 | 否 | 进程中所有运行的包名称。 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| bundleNames | Array
<
string
>
| 是 | 否 | 进程中所有运行的包名称。 |
## 使用说明
...
...
@@ -24,7 +24,8 @@
**示例:**
```
ts
import
appManager
from
'
@ohos.application.appManager
'
;
app
.
getProcessRunningInfos
().
then
((
data
)
=>
{
appManager
.
getProcessRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
'
success:
'
+
JSON
.
stringify
(
data
));
}).
catch
((
error
)
=>
{
console
.
log
(
'
failed:
'
+
JSON
.
stringify
(
error
));
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-processRunningInformation.md
浏览文件 @
4d9695f4
...
...
@@ -8,12 +8,13 @@ ProcessRunningInformation模块提供对进程运行信息进行设置和查询
## 使用说明
通过
[
appManager
](
js-apis-application-appManager.md#appmanagergetprocessrunninginformation9
)
来获取。
通过
appManager的
[
getProcessRunningInformation
](
js-apis-application-appManager.md#appmanagergetprocessrunninginformation9
)
来获取。
```
ts
import
appManager
from
'
@ohos.application.appManager
'
;
appManager
.
getProcessRunningInformation
((
error
,
data
)
=>
{
console
.
log
(
"
getProcessRunningInformation error:
"
+
error
.
code
+
"
data:
"
+
JSON
.
stringify
(
data
));
appManager
.
getProcessRunningInformation
((
error
,
data
)
=>
{
console
.
log
(
"
error:
"
+
error
.
code
+
"
data:
"
+
JSON
.
stringify
(
data
));
});
```
...
...
@@ -21,9 +22,9 @@ appManager.getProcessRunningInformation((error,data) => {
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
| 名称 | 类型 | 可读 | 可写 | 说明 |
| 名称 | 类型 | 可读 | 可写 | 说明 |
| -------- | -------- | -------- | -------- | -------- |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| bundleNames | Array
<
string
>
| 是 | 否 | 进程中所有运行的包名称。 |
| pid | number | 是 | 否 | 进程ID。 |
| uid | number | 是 | 否 | 用户ID。 |
| processName | string | 是 | 否 | 进程名称。 |
| bundleNames | Array
<
string
>
| 是 | 否 | 进程中所有运行的包名称。 |
zh-cn/application-dev/reference/apis/js-apis-inner-application-serviceExtensionContext.md
浏览文件 @
4d9695f4
...
...
@@ -19,7 +19,7 @@ ServiceExtensionContext模块提供ServiceExtensionAbility具有的能力和接
let
context
=
undefined
;
class
MainAbility
extends
ServiceExtensionAbility
{
onCreate
()
{
context
=
this
.
context
;
context
=
this
.
context
;
// 获取ServiceExtensionContext
}
}
```
...
...
@@ -36,10 +36,10 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
**错误码:**
...
...
@@ -103,16 +103,16 @@ startAbility(want: Want, options?: StartOptions): Promise\<void>;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| options |
[
StartOptions
](
js-apis-app-ability-startOptions.md
)
| 是 | 启动Ability所携带的参数。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| options |
[
StartOptions
](
js-apis-app-ability-startOptions.md
)
| 是 | 启动Ability所携带的参数。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -406,9 +406,9 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -545,9 +545,9 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -681,9 +681,9 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -807,9 +807,9 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -936,9 +936,9 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -995,9 +995,9 @@ terminateSelf(callback: AsyncCallback<void>): void;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
**错误码:**
...
...
@@ -1037,9 +1037,9 @@ terminateSelf(): Promise<void>;
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
@@ -1077,16 +1077,16 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| options |
[
ConnectOptions
](
js-apis-inner-ability-connectOptions.md
)
| 是 | ConnectOptions类型的回调函数,返回服务连接成功、断开或连接失败后的信息。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| want |
[
Want
](
js-apis-application-want.md
)
| 是 | Want类型参数,传入需要启动的ability的信息,如ability名称,包名等。 |
| options |
[
ConnectOptions
](
js-apis-inner-ability-connectOptions.md
)
| 是 | ConnectOptions类型的回调函数,返回服务连接成功、断开或连接失败后的信息。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| number | 返回一个number,后续根据这个number去断开连接。 |
| 类型 | 说明 |
| -------- | -------- |
| number | 返回一个number,后续根据这个number去断开连接。 |
**错误码:**
...
...
@@ -1197,10 +1197,10 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback<
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
| callback | AsyncCallback
<
void
>
| 否 | 回调函数,返回接口调用是否成功的结果。 |
**错误码:**
...
...
@@ -1249,15 +1249,15 @@ disconnectServiceExtensionAbility(connection: number): Promise<void>;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| connection | number | 是 | 在connectAbility中返回的number。 |
**返回值:**
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
| 类型 | 说明 |
| -------- | -------- |
| Promise
<
void
>
| 返回一个Promise,包含接口的结果。 |
**错误码:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-uiAbilityContext.md
浏览文件 @
4d9695f4
# UIAbilityContext
UIAbilityContext是Ability的上下文环境,继承自Context。
UIAbilityContext是
UI
Ability的上下文环境,继承自Context。
UIAbilityContext模块提供允许访问特定
Ability的资源的能力,包括对
Ability的启动、停止的设置、获取caller通信接口、拉起弹窗请求用户授权等。
UIAbilityContext模块提供允许访问特定
UIAbility的资源的能力,包括对UI
Ability的启动、停止的设置、获取caller通信接口、拉起弹窗请求用户授权等。
> **说明:**
>
...
...
@@ -19,7 +19,7 @@ UIAbilityContext模块提供允许访问特定Ability的资源的能力,包括
| currentHapModuleInfo |
[
HapModuleInfo
](
js-apis-bundleManager-hapModuleInfo.md
)
| 是 | 否 | 当前hap包的信息 |
| config |
[
Configuration
](
js-apis-app-ability-configuration.md
)
| 是 | 否 | 表示配置信息。 |
## AbilityContext.startAbility
##
UI
AbilityContext.startAbility
startAbility(want: Want, callback: AsyncCallback
<
void
>
): void;
...
...
@@ -85,7 +85,7 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
```
## AbilityContext.startAbility
##
UI
AbilityContext.startAbility
startAbility(want: Want, options: StartOptions, callback: AsyncCallback
<
void
>
): void;
...
...
@@ -103,7 +103,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
**错误码:**
| 错误码ID | 错误信息
| 错误码ID | 错误信息
|
| ------- | -------------------------------- |
| 201 | The application does not have permission to call the interface. |
| 401 | Invalid input parameter. |
...
...
@@ -155,7 +155,7 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
}
```
## AbilityContext.startAbility
##
UI
AbilityContext.startAbility
startAbility(want: Want, options?: StartOptions): Promise
<
void
>
;
...
...
@@ -230,7 +230,7 @@ startAbility(want: Want, options?: StartOptions): Promise<void>;
```
## AbilityContext.startAbilityForResult
##
UI
AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, callback: AsyncCallback
<
AbilityResult
>
): void;
...
...
@@ -297,7 +297,7 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
}
```
## AbilityContext.startAbilityForResult
##
UI
AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback
<
AbilityResult
>
): void;
...
...
@@ -369,7 +369,7 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback
```
## AbilityContext.startAbilityForResult
##
UI
AbilityContext.startAbilityForResult
startAbilityForResult(want: Want, options?: StartOptions): Promise
<
AbilityResult
>
;
...
...
@@ -444,7 +444,7 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes
}
```
## AbilityContext.startAbilityForResultWithAccount
##
UI
AbilityContext.startAbilityForResultWithAccount
startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncCallback
\<
AbilityResult>): void;
...
...
@@ -519,7 +519,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC
```
## AbilityContext.startAbilityForResultWithAccount
##
UI
AbilityContext.startAbilityForResultWithAccount
startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback
\<
void
\>
): void;
...
...
@@ -598,7 +598,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp
```
## AbilityContext.startAbilityForResultWithAccount
##
UI
AbilityContext.startAbilityForResultWithAccount
startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartOptions): Promise
\<
AbilityResult
\>
;
...
...
@@ -680,7 +680,7 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
## AbilityContext.startServiceExtensionAbility
##
UI
AbilityContext.startServiceExtensionAbility
startServiceExtensionAbility(want: Want, callback: AsyncCallback
\<
void>): void;
...
...
@@ -741,7 +741,7 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
}
```
## AbilityContext.startServiceExtensionAbility
##
UI
AbilityContext.startServiceExtensionAbility
startServiceExtensionAbility(want: Want): Promise
\<
void>;
...
...
@@ -801,7 +801,7 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
}
```
## AbilityContext.startServiceExtensionAbilityWithAccount
##
UI
AbilityContext.startServiceExtensionAbilityWithAccount
startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback
\<
void>): void;
...
...
@@ -863,7 +863,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
}
```
## AbilityContext.startServiceExtensionAbilityWithAccount
##
UI
AbilityContext.startServiceExtensionAbilityWithAccount
startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise
\<
void>;
...
...
@@ -927,7 +927,7 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
## AbilityContext.stopServiceExtensionAbility
##
UI
AbilityContext.stopServiceExtensionAbility
stopServiceExtensionAbility(want: Want, callback: AsyncCallback
\<
void>): void;
...
...
@@ -985,7 +985,7 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
}
```
## AbilityContext.stopServiceExtensionAbility
##
UI
AbilityContext.stopServiceExtensionAbility
stopServiceExtensionAbility(want: Want): Promise
\<
void>;
...
...
@@ -1042,7 +1042,7 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
}
```
## AbilityContext.stopServiceExtensionAbilityWithAccount
##
UI
AbilityContext.stopServiceExtensionAbilityWithAccount
stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback
\<
void>): void;
...
...
@@ -1105,7 +1105,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
}
```
## AbilityContext.stopServiceExtensionAbilityWithAccount
##
UI
AbilityContext.stopServiceExtensionAbilityWithAccount
stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise
\<
void>;
...
...
@@ -1167,7 +1167,7 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
}
```
## AbilityContext.terminateSelf
##
UI
AbilityContext.terminateSelf
terminateSelf(callback: AsyncCallback
<
void
>
): void;
...
...
@@ -1208,7 +1208,7 @@ terminateSelf(callback: AsyncCallback<void>): void;
```
## AbilityContext.terminateSelf
##
UI
AbilityContext.terminateSelf
terminateSelf(): Promise
<
void
>
;
...
...
@@ -1247,7 +1247,7 @@ terminateSelf(): Promise<void>;
```
## AbilityContext.terminateSelfWithResult
##
UI
AbilityContext.terminateSelfWithResult
terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback
<
void
>
): void;
...
...
@@ -1306,7 +1306,7 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi
```
## AbilityContext.terminateSelfWithResult
##
UI
AbilityContext.terminateSelfWithResult
terminateSelfWithResult(parameter: AbilityResult): Promise
<
void
>
;
...
...
@@ -1370,7 +1370,7 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
}
```
## AbilityContext.connectServiceExtensionAbility
##
UI
AbilityContext.connectServiceExtensionAbility
connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
...
...
@@ -1430,7 +1430,7 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
```
## AbilityContext.connectServiceExtensionAbilityWithAccount
##
UI
AbilityContext.connectServiceExtensionAbilityWithAccount
connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options: ConnectOptions): number;
...
...
@@ -1494,7 +1494,7 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
}
```
## AbilityContext.disconnectServiceExtensionAbility
##
UI
AbilityContext.disconnectServiceExtensionAbility
disconnectServiceExtensionAbility(connection: number): Promise
\<
void>;
...
...
@@ -1551,7 +1551,7 @@ disconnectServiceExtensionAbility(connection: number): Promise\<void>;
}
```
## AbilityContext.disconnectServiceExtensionAbility
##
UI
AbilityContext.disconnectServiceExtensionAbility
disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback
\<
void>): void;
...
...
@@ -1603,7 +1603,7 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\<vo
}
```
## AbilityContext.startAbilityByCall
##
UI
AbilityContext.startAbilityByCall
startAbilityByCall(want: Want): Promise
<
Caller
>
;
...
...
@@ -1690,7 +1690,7 @@ startAbilityByCall(want: Want): Promise<Caller>;
}
```
## AbilityContext.startAbilityWithAccount
##
UI
AbilityContext.startAbilityWithAccount
startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback
\<
void
\>
): void;
...
...
@@ -1764,7 +1764,7 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
```
## AbilityContext.startAbilityWithAccount
##
UI
AbilityContext.startAbilityWithAccount
startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, callback: AsyncCallback
\<
void
\>
): void;
...
...
@@ -1842,7 +1842,7 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
```
## AbilityContext.startAbilityWithAccount
##
UI
AbilityContext.startAbilityWithAccount
startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions): Promise
\<
void
\>
;
...
...
@@ -1918,7 +1918,7 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
}
```
## AbilityContext.requestPermissionsFromUser
##
UI
AbilityContext.requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array
<
string
>
, requestCallback: AsyncCallback
<
PermissionRequestResult
>
) : void;
...
...
@@ -1944,7 +1944,7 @@ requestPermissionsFromUser(permissions: Array<string>, requestCallback: As
```
## AbilityContext.requestPermissionsFromUser
##
UI
AbilityContext.requestPermissionsFromUser
requestPermissionsFromUser(permissions: Array
<
string
>
) : Promise
<
PermissionRequestResult
>
;
...
...
@@ -1977,7 +1977,7 @@ requestPermissionsFromUser(permissions: Array<string>) : Promise<Permis
```
## AbilityContext.setMissionLabel
##
UI
AbilityContext.setMissionLabel
setMissionLabel(label: string, callback:AsyncCallback
<
void
>
): void;
...
...
@@ -2001,7 +2001,7 @@ setMissionLabel(label: string, callback:AsyncCallback<void>): void;
```
## AbilityContext.setMissionLabel
##
UI
AbilityContext.setMissionLabel
setMissionLabel(label: string): Promise
<
void
>
;
...
...
@@ -2030,7 +2030,7 @@ setMissionLabel(label: string): Promise<void>;
console
.
log
(
'
failed:
'
+
JSON
.
stringify
(
error
));
});
```
## AbilityContext.setMissionIcon
##
UI
AbilityContext.setMissionIcon
setMissionIcon(icon: image.PixelMap, callback:AsyncCallback
\<
void>): void;
...
...
@@ -2072,7 +2072,7 @@ setMissionIcon(icon: image.PixelMap, callback:AsyncCallback\<void>): void;
```
## AbilityContext.setMissionIcon
##
UI
AbilityContext.setMissionIcon
setMissionIcon(icon: image.PixelMap): Promise
\<
void>;
...
...
@@ -2121,7 +2121,7 @@ setMissionIcon(icon: image.PixelMap): Promise\<void>;
console
.
log
(
'
-------------- setMissionIcon fail, err: -------------
'
,
err
);
});
```
## AbilityContext.restoreWindowStage
##
UI
AbilityContext.restoreWindowStage
restoreWindowStage(localStorage: LocalStorage) : void;
...
...
@@ -2142,7 +2142,7 @@ restoreWindowStage(localStorage: LocalStorage) : void;
this
.
context
.
restoreWindowStage
(
storage
);
```
## AbilityContext.isTerminating
##
UI
AbilityContext.isTerminating
isTerminating(): boolean;
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-triggerInfo.md
浏览文件 @
4d9695f4
# TriggerInfo
定义触发WantAgent所需要的的信息
作为
[
trigger
](
js-apis-app-ability-wantAgent.md#wantagenttrigger
)
的入参定义触发WantAgent所需要的的信息。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -10,57 +10,3 @@
| want | Want | 否 | Want。 |
| permission | string | 否 | 权限定义。 |
| extraInfo | {[key: string]: any} | 否 | 额外数据。 |
**示例:**
```
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
));
})
```
\ No newline at end of file
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
浏览文件 @
4d9695f4
# WantAgentInfo
定义触发WantAgent所需要的
的信息
定义触发WantAgent所需要的
信息,可以作为
[
getWantAgent
](
js-apis-app-ability-wantAgent.md#wantagentgetwantagent
)
的入参创建指定的WantAgent对象。
**系统能力**
:以下各项对应的系统能力均为SystemCapability.Ability.AbilityRuntime.Core
...
...
@@ -11,36 +11,3 @@
| requestCode | number | 是 | 使用者定义的一个私有值。 |
| wantAgentFlags | Array
<
[
wantAgent.WantAgentFlags
](
js-apis-wantAgent.md#WantAgentFlags
)
>
| 否 | 动作执行属性。 |
| extraInfo | {[key: string]: any} | 否 | 额外数据。 |
**示例:**
```
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
"
}
}
wantAgent
.
getWantAgent
(
wantAgentInfo
).
then
((
data
)
=>
{
console
.
info
(
"
getWantAgent data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
console
.
error
(
"
getWantAgent err:
"
+
JSON
.
stringify
(
err
));
})
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录