Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
00b43c9a
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看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
00b43c9a
编写于
12月 23, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 23, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12744 commonEvent.md 接口链接地址替换为 CommonEventManager.md 接口相关链接地址
Merge pull request !12744 from zyjhandsome/master
上级
5dc82125
cf2c5620
变更
19
显示空白变更内容
内联
并排
Showing
19 changed file
with
74 addition
and
59 deletion
+74
-59
zh-cn/application-dev/ability-deprecated/wantagent.md
zh-cn/application-dev/ability-deprecated/wantagent.md
+5
-5
zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md
.../application-models/ability-startup-with-implicit-want.md
+2
-1
zh-cn/application-dev/application-models/application-context-stage.md
...ation-dev/application-models/application-context-stage.md
+2
-2
zh-cn/application-dev/application-models/common-event-publish.md
...pplication-dev/application-models/common-event-publish.md
+2
-2
zh-cn/application-dev/application-models/common-event-subscription.md
...ation-dev/application-models/common-event-subscription.md
+1
-1
zh-cn/application-dev/application-models/common-event-unsubscription.md
...ion-dev/application-models/common-event-unsubscription.md
+1
-1
zh-cn/application-dev/application-models/thread-model-stage.md
.../application-dev/application-models/thread-model-stage.md
+1
-1
zh-cn/application-dev/application-models/uiability-lifecycle.md
...application-dev/application-models/uiability-lifecycle.md
+16
-1
zh-cn/application-dev/faqs/faqs-event-notification.md
zh-cn/application-dev/faqs/faqs-event-notification.md
+1
-1
zh-cn/application-dev/media/avsession-guidelines.md
zh-cn/application-dev/media/avsession-guidelines.md
+1
-1
zh-cn/application-dev/notification/notification-with-wantagent.md
...plication-dev/notification/notification-with-wantagent.md
+4
-4
zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
...s/js-apis-application-staticSubscriberExtensionAbility.md
+3
-3
zh-cn/application-dev/reference/apis/js-apis-avsession.md
zh-cn/application-dev/reference/apis/js-apis-avsession.md
+13
-13
zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md
...ation-dev/reference/apis/js-apis-backgroundTaskManager.md
+11
-11
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
...v/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
+1
-1
zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
...ce/apis/js-apis-resourceschedule-backgroundTaskManager.md
+2
-2
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
+7
-7
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md
+0
-1
zh-cn/application-dev/task-management/continuous-task-dev-guide.md
...lication-dev/task-management/continuous-task-dev-guide.md
+1
-1
未找到文件。
zh-cn/application-dev/ability-deprecated/wantagent.md
浏览文件 @
00b43c9a
...
...
@@ -14,13 +14,13 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
## 开发步骤
1.
导入WantAgent模块。
```
```
ts
import
wantAgent
from
'
@ohos.wantAgent
'
;
```
2.
创建拉起Ability的WantAgentInfo信息。详细的WantAgentInfo信息数据类型及包含的参数请见
[
WantAgentInfo文档
](
../reference/apis/js-apis-wantAgent.md#wantagentinfo
)
介绍。
```
```
ts
private
wantAgentObj
=
null
// 用于保存创建成功的wantAgent对象,后续使用其完成触发的动作。
// wantAgentInfo
...
...
@@ -44,7 +44,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
3.
创建发布公共事件的WantAgentInfo信息。
```
```
ts
private
wantAgentObj
=
null
// 用于保存创建成功的WantAgent对象,后续使用其完成触发的动作。
// wantAgentInfo
...
...
@@ -63,7 +63,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
4.
创建WantAgent,保存返回的WantAgent对象wantAgentObj,用于执行后续触发操作。
```
```
ts
// 创建WantAgent
wantAgent
.
getWantAgent
(
wantAgentInfo
,
(
err
,
wantAgentObj
)
=>
{
if
(
err
.
code
)
{
...
...
@@ -77,7 +77,7 @@ WantAgent封装了一个行为意图信息,可以通过WantAgent.trigger接口
5.
触发WantAgent。
```
```
ts
// 触发WantAgent。
var
triggerInfo
=
{
code
:
0
...
...
zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md
浏览文件 @
00b43c9a
...
...
@@ -78,4 +78,5 @@
4.
want内type不为空,且被skills内type包含,匹配成功。
2.
当有多个匹配应用时,会被应用选择器展示给用户进行选择。
<img
src=
"figures/stage-want1.png"
alt=
"stage-want1"
style=
"zoom:50%;"
/>
2.
当有多个匹配应用时,会被应用选择器展示给用户进行选择。
<img
src=
"figures/stage-want1.png"
alt=
"stage-want1"
style=
"zoom:80%;"
/>
zh-cn/application-dev/application-models/application-context-stage.md
浏览文件 @
00b43c9a
...
...
@@ -93,7 +93,7 @@
获取路径的能力是基类Context中提供的能力,因此在ApplicationContext、AbilityStageContext、UIAbilityContext和ExtensionContext中均可以获取,在各类Context中获取到的路径会有一些差别,具体差别如下图所示。
**图1**
Context中获取的应用开发路径
**图1**
Context中获取的应用开发路径
<img
src=
"figures/context-dir.png"
alt=
"context-dir"
style=
"zoom: 50%;"
/>
-
通过ApplicationContext获取的应用级别路径。应用全局信息建议存放的路径,存放在此路径的文件内容仅在应用卸载时会被删除。
...
...
@@ -305,5 +305,5 @@ export default class EntryAbility extends UIAbility {
应用需要获取用户的隐私信息或使用系统能力时,例如获取位置信息、访问日历、使用相机拍摄照片或录制视频等,需要向用户申请授权,示意效果如下图所示。具体使用请参见
[
访问控制授权申请指导
](
../security/accesstoken-guidelines.md
)
。
**图2**
向用户申请日历访问授权
**图2**
向用户申请日历访问授权
<img
src=
"figures/application-context-stage.png"
alt=
"application-context-stage"
style=
"zoom:50%;"
/>
\ No newline at end of file
zh-cn/application-dev/application-models/common-event-publish.md
浏览文件 @
00b43c9a
...
...
@@ -3,7 +3,7 @@
## 场景介绍
当需要发布某个自定义公共事件时,可以通过
[
publish()
](
../reference/apis/js-apis-commonEvent
.md#commonevent
publish
)
方法发布事件。发布的公共事件可以携带数据,供订阅者解析并进行下一步处理。
当需要发布某个自定义公共事件时,可以通过
[
publish()
](
../reference/apis/js-apis-commonEvent
Manager.md#commoneventmanager
publish
)
方法发布事件。发布的公共事件可以携带数据,供订阅者解析并进行下一步处理。
> **须知:**
> 已发出的粘性公共事件后来订阅者也可以接收到,其他公共事件都需要先订阅再接收,订阅参考[公共事件订阅章节](common-event-subscription.md)。
...
...
@@ -11,7 +11,7 @@
## 接口说明
详细接口见
[
接口文档
](
../reference/apis/js-apis-commonEvent
.md#commonevent
publish
)
。
详细接口见
[
接口文档
](
../reference/apis/js-apis-commonEvent
Manager.md#commoneventmanager
publish
)
。
| 接口名 | 接口描述 |
| -------- | -------- |
...
...
zh-cn/application-dev/application-models/common-event-subscription.md
浏览文件 @
00b43c9a
...
...
@@ -8,7 +8,7 @@
## 接口说明
详细接口见
[
接口文档
](
../reference/apis/js-apis-commonEvent
.md#commoneventcreatesubscriber
)
。
详细接口见
[
接口文档
](
../reference/apis/js-apis-commonEvent
Manager.md#commoneventmanagersubscribe
)
。
| 接口名 | 接口描述 |
| -------- | -------- |
...
...
zh-cn/application-dev/application-models/common-event-unsubscription.md
浏览文件 @
00b43c9a
...
...
@@ -3,7 +3,7 @@
## 场景介绍
订阅者完成业务需要时,需要主动取消订阅,订阅者通过调用
[
unsubscribe()
](
../reference/apis/js-apis-commonEvent
.md#commonevent
unsubscribe
)
方法取消订阅事件。
订阅者完成业务需要时,需要主动取消订阅,订阅者通过调用
[
unsubscribe()
](
../reference/apis/js-apis-commonEvent
Manager.md#commoneventmanager
unsubscribe
)
方法取消订阅事件。
## 接口说明
...
...
zh-cn/application-dev/application-models/thread-model-stage.md
浏览文件 @
00b43c9a
...
...
@@ -18,7 +18,7 @@ OpenHarmony应用中每个进程都会有一个主线程,主线程有如下职
![
thread-model-stage
](
figures/thread-model-stage.png
)
基于OpenHarmony的线程模型,不同的业务功能运行在不同的线程上,业务功能的交互就需要线程间通信。线程间通信目前主要有Emitter和Worker两种方式,其中Emitter主要适用于线程间的事件同步, Worker主要用于新开一个线程执行耗时任务。
基于OpenHarmony的线程模型,不同的业务功能运行在不同的线程上,业务功能的交互就需要线程间通信。
同一个进程内,
线程间通信目前主要有Emitter和Worker两种方式,其中Emitter主要适用于线程间的事件同步, Worker主要用于新开一个线程执行耗时任务。
**说明:**
...
...
zh-cn/application-dev/application-models/uiability-lifecycle.md
浏览文件 @
00b43c9a
...
...
@@ -39,15 +39,26 @@ UIAbility实例创建完成之后,在进入Foreground之前,系统会创建
**图2**
WindowStageCreate和WindowStageDestory状态
<img
src=
"figures/Ability-Life-Cycle-WindowStage.png"
alt=
"Ability-Life-Cycle-WindowStage"
style=
"zoom:50%;"
/>
在onWindowStageCreate()回调中通过loadContent()方法设置应用要加载的页面并根据需要
订阅WindowStage的
[
事件
](
../reference/apis/js-apis-window.md#windowstageeventtype9
)
(获焦/失焦、可见/不可见)。
在onWindowStageCreate()回调中通过
[
loadContent()
](
../reference/apis/js-apis-window.md#loadcontent9-2
)
方法设置应用要加载的页面,并根据需要调用
[
on('windowStageEvent')
](
../reference/apis/js-apis-window.md#onwindowstageevent9
)
方法
订阅WindowStage的
[
事件
](
../reference/apis/js-apis-window.md#windowstageeventtype9
)
(获焦/失焦、可见/不可见)。
```
ts
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
import
Window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onWindowStageCreate
(
windowStage
:
Window
.
WindowStage
)
{
// 设置WindowStage的事件订阅(获焦/失焦、可见/不可见)
try
{
windowStage
.
on
(
'
windowStageEvent
'
,
(
data
)
=>
{
console
.
info
(
'
Succeeded in enabling the listener for window stage event changes. Data:
'
+
JSON
.
stringify
(
data
));
});
}
catch
(
exception
)
{
console
.
error
(
'
Failed to enable the listener for window stage event changes. Cause:
'
+
JSON
.
stringify
(
exception
));
};
// 设置UI界面加载
windowStage
.
loadContent
(
'
pages/Index
'
,
(
err
,
data
)
=>
{
...
...
@@ -94,6 +105,8 @@ onBackground()回调,在UIAbility的UI界面完全不可见之后,如UIAbili
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onForeground
()
{
// 申请系统需要的资源,或者重新申请在onBackground中释放的资源
}
...
...
@@ -117,6 +130,8 @@ import UIAbility from '@ohos.app.ability.UIAbility';
import
Window
from
'
@ohos.window
'
;
export
default
class
EntryAbility
extends
UIAbility
{
// ...
onDestroy
()
{
// 系统资源的释放、数据的保存等
}
...
...
zh-cn/application-dev/faqs/faqs-event-notification.md
浏览文件 @
00b43c9a
...
...
@@ -12,7 +12,7 @@ emitter数据大小限制不超过10240。
通过配置Notification.publish发布通知接口的参数NotificationRequest中wantAgent属性实现
参考文档:
[
Notification
](
../reference/apis/js-apis-notification.md#notificationpublish
)
、
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
参考文档:
[
Notification
](
../reference/apis/js-apis-notification.md#notificationpublish
)
、
[
WantAgent
](
../reference/apis/js-apis-
app-ability-
wantAgent.md
)
示例:
...
...
zh-cn/application-dev/media/avsession-guidelines.md
浏览文件 @
00b43c9a
...
...
@@ -50,7 +50,7 @@ avSession.createAVSession(context, "AudioAppSample", 'audio').then((session) =>
3.
设置AVSession会话信息,包括:
-
设置会话元数据,除了媒体ID必选外,可选设置媒体标题、专辑信息、媒体作者、媒体时长、上一首/下一首媒体ID等。详细的会话元数据信息可参考API文档中的
`AVMetadata`
。
-
设置启动Ability,通过
`WantAgent`
的接口实现。WantAgent一般用于封装行为意图信息,如果想要了解更多信息,可以查阅
[
WantAgent开发指导
](
../reference/apis/js-apis-wantAgent.md
)
。
-
设置启动Ability,通过
[
WantAgent
](
../reference/apis/js-apis-app-ability-wantAgent.md
)
的接口实现。WantAgent一般用于封装行为意图信息
。
-
设置播放状态。
```
js
// 设置会话元数据
...
...
zh-cn/application-dev/notification/notification-with-wantagent.md
浏览文件 @
00b43c9a
# 为通知添加行为意图
[
WantAgent
](
../reference/apis/js-apis-
wantAgent.md
)
提供了封装行为意图的能力,该行为意图是指拉起指定的应用组件及发布公共事件等能力。OpenHarmony支持以通知的形式,将
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
从发布方传递至接收方,从而在接收方触发
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
中指定的意图。例如在通知消息的发布者发布通知时,通常期望用户可以通过通知栏点击拉起目标应用组件。为了达成这一目标,开发者可以将
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
封装至通知消息中,当系统接收到
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
后,在用户点击通知栏时触发
[
WantAgent
](
../reference/apis/js-apis
-wantAgent.md
)
的意图,从而拉起目标应用组件。
[
WantAgent
](
../reference/apis/js-apis-
app-ability-wantAgent.md
)
提供了封装行为意图的能力,该行为意图是指拉起指定的应用组件及发布公共事件等能力。OpenHarmony支持以通知的形式,将
[
WantAgent
](
../reference/apis/js-apis-app-ability-wantAgent.md
)
从发布方传递至接收方,从而在接收方触发
[
WantAgent
](
../reference/apis/js-apis-app-ability-wantAgent.md
)
中指定的意图。例如在通知消息的发布者发布通知时,通常期望用户可以通过通知栏点击拉起目标应用组件。为了达成这一目标,开发者可以将
[
WantAgent
](
../reference/apis/js-apis-app-ability-wantAgent.md
)
封装至通知消息中,当系统接收到
[
WantAgent
](
../reference/apis/js-apis-app-ability-wantAgent.md
)
后,在用户点击通知栏时触发
[
WantAgent
](
../reference/apis/js-apis-app-ability
-wantAgent.md
)
的意图,从而拉起目标应用组件。
为通知添加行为意图的实现方式如下图所示:发布通知的应用向应用组件管理服务AMS(Ability Manager Service)申请
[
WantAgent
](
../reference/apis/js-apis-
wantAgent.md
)
,然后随其他通知信息一起发送给桌面,当用户在桌面通知栏上点击通知时,触发
[
WantAgent
](
../reference/apis/js-apis
-wantAgent.md
)
动作。
为通知添加行为意图的实现方式如下图所示:发布通知的应用向应用组件管理服务AMS(Ability Manager Service)申请
[
WantAgent
](
../reference/apis/js-apis-
app-ability-wantAgent.md
)
,然后随其他通知信息一起发送给桌面,当用户在桌面通知栏上点击通知时,触发
[
WantAgent
](
../reference/apis/js-apis-app-ability
-wantAgent.md
)
动作。
**图1**
携带行为意图的通知运行机制
![
notification-with-wantagent
](
figures/notification-with-wantagent.png
)
...
...
@@ -10,7 +10,7 @@
## 接口说明
具体接口描述,详见
[
WantAgent接口文档
](
../reference/apis/js-apis-wantAgent.md
)
。
具体接口描述,详见
[
WantAgent接口文档
](
../reference/apis/js-apis-
app-ability-
wantAgent.md
)
。
| | |
| -------- | -------- |
...
...
@@ -78,7 +78,7 @@
}
```
4.
调用
[
getWantAgent()
](
../reference/apis/js-apis-wantAgent.md#wantagentgetwantagent
)
方法进行创建WantAgent。
4.
调用
[
getWantAgent()
](
../reference/apis/js-apis-
app-ability-
wantAgent.md#wantagentgetwantagent
)
方法进行创建WantAgent。
```
typescript
// 创建WantAgent
...
...
zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md
浏览文件 @
00b43c9a
...
...
@@ -24,9 +24,9 @@ onReceiveEvent(event: CommonEventData): void;
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| event |
[
CommonEventData
](
js-apis-commonEvent.md#commoneventdata
)
| 是 | 静态订阅者通用事件回调。 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------- | -------- | -------- |
| event |
[
CommonEventData
](
js-apis-commonEventManager.md#commoneventdata
)
| 是 | 静态订阅者通用事件回调。 |
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-avsession.md
浏览文件 @
00b43c9a
...
...
@@ -979,8 +979,8 @@ setLaunchAbility(ability: WantAgent): Promise\<void>
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| ------- | --------------------------------- | ---- | ----------------------------------------------------------- |
| ability |
[
WantAgent
](
js-apis-wantAgent.md
)
| 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
| ------- | ---------------------------------
------------
| ---- | ----------------------------------------------------------- |
| ability |
[
WantAgent
](
js-apis-
app-ability-
wantAgent.md
)
| 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
**返回值:**
...
...
@@ -1049,8 +1049,8 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\<void>): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ---------------------------------
| ---- |
----------------------------------------------------------- |
| ability |
[
WantAgent
](
js-apis-
wantAgent.md
)
| 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。
|
| -------- | ---------------------------------
------------ | ---- | -
----------------------------------------------------------- |
| ability |
[
WantAgent
](
js-apis-
app-ability-wantAgent.md
)
| 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。
|
| callback | AsyncCallback<void
\>
| 是 | 回调函数。当Ability设置成功,err为undefined,否则返回错误对象。 |
**错误码:**
...
...
@@ -2205,8 +2205,8 @@ getLaunchAbility(): Promise\<WantAgent>
**返回值:**
| 类型 | 说明 |
| ------------------------------------------- | ------------------------------------------------------------ |
| Promise<
[
WantAgent
](
js-apis-wantAgent.md
)
\>
| Promise对象,返回在
[
setLaunchAbility
](
#setlaunchability
)
保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
| -------------------------------------------
------------
| ------------------------------------------------------------ |
| Promise<
[
WantAgent
](
js-apis-
app-ability-
wantAgent.md
)
\>
| Promise对象,返回在
[
setLaunchAbility
](
#setlaunchability
)
保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
**错误码:**
以下错误码的详细介绍请参见
[
ohos.multimedia.avsession(多媒体会话)错误码
](
../errorcodes/errorcode-avsession.md
)
。
...
...
@@ -2240,8 +2240,8 @@ getLaunchAbility(callback: AsyncCallback\<WantAgent>): void
**参数:**
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------------------------------- | ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<
[
WantAgent
](
js-apis-wantAgent.md
)
\>
| 是 | 回调函数。返回在
[
setLaunchAbility
](
#setlaunchability
)
保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
| -------- | -------------------------------------------------
-----------
| ---- | ------------------------------------------------------------ |
| callback | AsyncCallback<
[
WantAgent
](
js-apis-
app-ability-
wantAgent.md
)
\>
| 是 | 回调函数。返回在
[
setLaunchAbility
](
#setlaunchability
)
保存的对象,包括应用的相关属性信息,如bundleName,abilityName,deviceId等。 |
**错误码:**
以下错误码的详细介绍请参见
[
ohos.multimedia.avsession(多媒体会话)错误码
](
../errorcodes/errorcode-avsession.md
)
。
...
...
zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md
浏览文件 @
00b43c9a
...
...
@@ -160,10 +160,10 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**参数**
:
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------
| ---- |
---------------------------------------- |
| --------- | ----------------------------------
----------- | ---- | --------------------
---------------------------------------- |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode8
)
| 是 | 向系统申请的后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-
wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。
|
| wantAgent |
[
WantAgent
](
js-apis-
app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。
|
| callback | AsyncCallback
<
void
>
| 是 | callback形式返回启动长时任务的结果。 |
**示例**
:
...
...
@@ -252,10 +252,10 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**参数**
:
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ----------------------------------
| ---- |
---------------------------------------- |
| --------- | ----------------------------------
----------- | ---- | --------------------
---------------------------------------- |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode8
)
| 是 | 向系统申请的后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-
wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击跳转的界面。
|
| wantAgent |
[
WantAgent
](
js-apis-
app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击跳转的界面。
|
**返回值**
:
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md
浏览文件 @
00b43c9a
...
...
@@ -9,5 +9,5 @@
| wants | Array
\<
Want
\>
| 是 | 将被执行的动作列表。 |
| operationType | wantAgent.OperationType | 是 | 动作类型。 |
| requestCode | number | 是 | 使用者定义的一个私有值。 |
| wantAgentFlags | Array
<
[
wantAgent.WantAgentFlags
](
js-apis-
wantAgent.md#WantAgentF
lags
)
>
| 否 | 动作执行属性。 |
| wantAgentFlags | Array
<
[
wantAgent.WantAgentFlags
](
js-apis-
app-ability-wantAgent.md#wantagentf
lags
)
>
| 否 | 动作执行属性。 |
| extraInfo | {[key: string]: any} | 否 | 额外数据。 |
zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
浏览文件 @
00b43c9a
...
...
@@ -235,7 +235,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 | 向系统申请的后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-
wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| wantAgent |
[
WantAgent
](
js-apis-
app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 |
| callback | AsyncCallback
<
void
>
| 是 | callback形式返回启动长时任务的结果。 |
**错误码**
:
...
...
@@ -309,7 +309,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
| --------- | ---------------------------------- | ---- | ---------------------------------------- |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-ability-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 | 向系统申请的后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-
wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
| wantAgent |
[
WantAgent
](
js-apis-
app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 |
**返回值**
:
...
...
zh-cn/application-dev/reference/apis/js-apis-system-timer.md
浏览文件 @
00b43c9a
...
...
@@ -34,11 +34,11 @@ import systemTimer from '@ohos.systemTimer';
**系统能力:**
SystemCapability.MiscServices.Time
| 名称 | 类型 | 必填 | 说明 |
| --------- | --------------------------------- | ---- | ------------------------------------------------------------ |
| --------- | ---------------------------------
------------
| ---- | ------------------------------------------------------------ |
| type | number | 是 | 定时器类型。
<br>
取值为1时,表示为系统启动时间定时器(定时器启动时间不能晚于当前设置的系统时间) ;
<br>
取值为2时,表示为唤醒定时器;
<br>
取值为4时,表示为精准定时器;
<br>
取值为5时,表示为IDLE模式定时器(暂不支持)。 |
| repeat | boolean | 是 | true为循环定时器,false为单次定时器。 |
| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 |
| wantAgent |
[
WantAgent
](
js-apis-wantAgent.md
)
| 否 | 设置通知的WantAgent,定时器到期后通知。(支持拉起应用MainAbility,暂不支持拉起ServiceAbility。) |
| wantAgent |
[
WantAgent
](
js-apis-
app-ability-
wantAgent.md
)
| 否 | 设置通知的WantAgent,定时器到期后通知。(支持拉起应用MainAbility,暂不支持拉起ServiceAbility。) |
| callback | number | 是 | 以回调函数的形式返回定时器的ID。 |
...
...
zh-cn/application-dev/reference/apis/js-apis-wantAgent.md
浏览文件 @
00b43c9a
...
...
@@ -227,7 +227,6 @@ getBundleName(agent: WantAgent): Promise\<string\>
```
js
import
WantAgent
from
'
@ohos.wantAgent
'
;
//wantAgent对象
var
wantAgent
;
...
...
zh-cn/application-dev/task-management/continuous-task-dev-guide.md
浏览文件 @
00b43c9a
...
...
@@ -15,7 +15,7 @@
| stopBackgroundRunning(context: Context): Promise
<
void
>
| 停止后台长时任务的运行。 |
其中,wantAgent的信息详见(
[
WantAgent
](
../reference/apis/js-apis-wantAgent.md
)
)
其中,wantAgent的信息详见(
[
WantAgent
](
../reference/apis/js-apis-
app-ability-
wantAgent.md
)
)
**表2**
后台模式类型
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录