diff --git a/zh-cn/application-dev/ability-deprecated/wantagent.md b/zh-cn/application-dev/ability-deprecated/wantagent.md index 5ce8f9a049819f126c8e5b57dc5aa3865ed98432..9e293023a2ac8f8dbfb233fea3a227abcada41f8 100644 --- a/zh-cn/application-dev/ability-deprecated/wantagent.md +++ b/zh-cn/application-dev/ability-deprecated/wantagent.md @@ -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 diff --git a/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md b/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md index f2c0bb04b0d1454a2d8a02d4f53a08e13a9ff2c7..8b120b81e72168a6c01576ea5a9b8e638e9febba 100644 --- a/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md +++ b/zh-cn/application-dev/application-models/ability-startup-with-implicit-want.md @@ -78,4 +78,5 @@ 4. want内type不为空,且被skills内type包含,匹配成功。 -2. 当有多个匹配应用时,会被应用选择器展示给用户进行选择。stage-want1 +2. 当有多个匹配应用时,会被应用选择器展示给用户进行选择。 + stage-want1 diff --git a/zh-cn/application-dev/application-models/application-context-stage.md b/zh-cn/application-dev/application-models/application-context-stage.md index 5ec374fbeebce38f1881faf4e7c362dacbd1774f..55b88aef53c787a078af37e39146dd68e620e4b8 100644 --- a/zh-cn/application-dev/application-models/application-context-stage.md +++ b/zh-cn/application-dev/application-models/application-context-stage.md @@ -93,7 +93,7 @@ 获取路径的能力是基类Context中提供的能力,因此在ApplicationContext、AbilityStageContext、UIAbilityContext和ExtensionContext中均可以获取,在各类Context中获取到的路径会有一些差别,具体差别如下图所示。 - **图1** Context中获取的应用开发路径 +**图1** Context中获取的应用开发路径 context-dir - 通过ApplicationContext获取的应用级别路径。应用全局信息建议存放的路径,存放在此路径的文件内容仅在应用卸载时会被删除。 @@ -305,5 +305,5 @@ export default class EntryAbility extends UIAbility { 应用需要获取用户的隐私信息或使用系统能力时,例如获取位置信息、访问日历、使用相机拍摄照片或录制视频等,需要向用户申请授权,示意效果如下图所示。具体使用请参见[访问控制授权申请指导](../security/accesstoken-guidelines.md)。 - **图2** 向用户申请日历访问授权 +**图2** 向用户申请日历访问授权 application-context-stage \ No newline at end of file diff --git a/zh-cn/application-dev/application-models/common-event-publish.md b/zh-cn/application-dev/application-models/common-event-publish.md index 5265575821ca3a6884f070248cba4f668cd1562f..57007759a77fdab403d3c16fe60fef53487440f5 100644 --- a/zh-cn/application-dev/application-models/common-event-publish.md +++ b/zh-cn/application-dev/application-models/common-event-publish.md @@ -3,7 +3,7 @@ ## 场景介绍 -当需要发布某个自定义公共事件时,可以通过[publish()](../reference/apis/js-apis-commonEvent.md#commoneventpublish)方法发布事件。发布的公共事件可以携带数据,供订阅者解析并进行下一步处理。 +当需要发布某个自定义公共事件时,可以通过[publish()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerpublish)方法发布事件。发布的公共事件可以携带数据,供订阅者解析并进行下一步处理。 > **须知:** > 已发出的粘性公共事件后来订阅者也可以接收到,其他公共事件都需要先订阅再接收,订阅参考[公共事件订阅章节](common-event-subscription.md)。 @@ -11,7 +11,7 @@ ## 接口说明 -详细接口见[接口文档](../reference/apis/js-apis-commonEvent.md#commoneventpublish)。 +详细接口见[接口文档](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerpublish)。 | 接口名 | 接口描述 | | -------- | -------- | diff --git a/zh-cn/application-dev/application-models/common-event-subscription.md b/zh-cn/application-dev/application-models/common-event-subscription.md index 459c91a26765f7de64344da8db2742e4289eb086..785ea8d3a19fbeee57d938a07955370f0f3ca2b3 100644 --- a/zh-cn/application-dev/application-models/common-event-subscription.md +++ b/zh-cn/application-dev/application-models/common-event-subscription.md @@ -8,7 +8,7 @@ ## 接口说明 -详细接口见[接口文档](../reference/apis/js-apis-commonEvent.md#commoneventcreatesubscriber)。 +详细接口见[接口文档](../reference/apis/js-apis-commonEventManager.md#commoneventmanagersubscribe)。 | 接口名 | 接口描述 | | -------- | -------- | diff --git a/zh-cn/application-dev/application-models/common-event-unsubscription.md b/zh-cn/application-dev/application-models/common-event-unsubscription.md index 1ba9296f83b7f5d1716ba4698aba5f20d982fbe1..1f7a23db104b8a8725b5d7711bd5a0dcb223b55f 100644 --- a/zh-cn/application-dev/application-models/common-event-unsubscription.md +++ b/zh-cn/application-dev/application-models/common-event-unsubscription.md @@ -3,7 +3,7 @@ ## 场景介绍 -订阅者完成业务需要时,需要主动取消订阅,订阅者通过调用[unsubscribe()](../reference/apis/js-apis-commonEvent.md#commoneventunsubscribe)方法取消订阅事件。 +订阅者完成业务需要时,需要主动取消订阅,订阅者通过调用[unsubscribe()](../reference/apis/js-apis-commonEventManager.md#commoneventmanagerunsubscribe)方法取消订阅事件。 ## 接口说明 diff --git a/zh-cn/application-dev/application-models/thread-model-stage.md b/zh-cn/application-dev/application-models/thread-model-stage.md index 715a2c2551f8f6f50e7c401c55d1ecd65492b0f7..9c238e1b8c404d47754ccd361b34cb6a112cbd5c 100644 --- a/zh-cn/application-dev/application-models/thread-model-stage.md +++ b/zh-cn/application-dev/application-models/thread-model-stage.md @@ -18,7 +18,7 @@ OpenHarmony应用中每个进程都会有一个主线程,主线程有如下职 ![thread-model-stage](figures/thread-model-stage.png) -基于OpenHarmony的线程模型,不同的业务功能运行在不同的线程上,业务功能的交互就需要线程间通信。线程间通信目前主要有Emitter和Worker两种方式,其中Emitter主要适用于线程间的事件同步, Worker主要用于新开一个线程执行耗时任务。 +基于OpenHarmony的线程模型,不同的业务功能运行在不同的线程上,业务功能的交互就需要线程间通信。同一个进程内,线程间通信目前主要有Emitter和Worker两种方式,其中Emitter主要适用于线程间的事件同步, Worker主要用于新开一个线程执行耗时任务。 **说明:** diff --git a/zh-cn/application-dev/application-models/uiability-lifecycle.md b/zh-cn/application-dev/application-models/uiability-lifecycle.md index 92c14fee24fc307bc840324939d12a7429c2f704..38ed7c2a10227a117e5cba90e38f56c1b26c66f6 100644 --- a/zh-cn/application-dev/application-models/uiability-lifecycle.md +++ b/zh-cn/application-dev/application-models/uiability-lifecycle.md @@ -39,15 +39,26 @@ UIAbility实例创建完成之后,在进入Foreground之前,系统会创建 **图2** WindowStageCreate和WindowStageDestory状态 Ability-Life-Cycle-WindowStage - 在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() { // 系统资源的释放、数据的保存等 } diff --git a/zh-cn/application-dev/faqs/faqs-event-notification.md b/zh-cn/application-dev/faqs/faqs-event-notification.md index a035a5890812c27cd910dd44cea913b3f7abc0c2..8fb2332c1856b23489045e0b087afd1d1708b693 100644 --- a/zh-cn/application-dev/faqs/faqs-event-notification.md +++ b/zh-cn/application-dev/faqs/faqs-event-notification.md @@ -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) 示例: diff --git a/zh-cn/application-dev/media/avsession-guidelines.md b/zh-cn/application-dev/media/avsession-guidelines.md index 267802f1a4b43042857bdc292a6c36f75a6b159d..41ab8c7dd444713cfa0f5459cf8064a2cf57bd46 100644 --- a/zh-cn/application-dev/media/avsession-guidelines.md +++ b/zh-cn/application-dev/media/avsession-guidelines.md @@ -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 // 设置会话元数据 diff --git a/zh-cn/application-dev/notification/notification-with-wantagent.md b/zh-cn/application-dev/notification/notification-with-wantagent.md index a511ca4d809b89b571f0b785b9aa43d0fe0ae405..c137a122f9a0c1a9f879b90ee52344bf2febbf3c 100644 --- a/zh-cn/application-dev/notification/notification-with-wantagent.md +++ b/zh-cn/application-dev/notification/notification-with-wantagent.md @@ -1,8 +1,8 @@ # 为通知添加行为意图 -[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 diff --git a/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md b/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md index 21b6a8f94ec1289e3b51740c8b7fdea15f13d2c9..e2481c7e2165fa819870b9bfbef9c28a09340f04 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md +++ b/zh-cn/application-dev/reference/apis/js-apis-application-staticSubscriberExtensionAbility.md @@ -24,9 +24,9 @@ onReceiveEvent(event: CommonEventData): void; **参数:** - | 参数名 | 类型 | 必填 | 说明 | - | -------- | -------- | -------- | -------- | - | event | [CommonEventData](js-apis-commonEvent.md#commoneventdata) | 是 | 静态订阅者通用事件回调。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | -------- | -------- | -------- | +| event | [CommonEventData](js-apis-commonEventManager.md#commoneventdata) | 是 | 静态订阅者通用事件回调。 | **示例:** diff --git a/zh-cn/application-dev/reference/apis/js-apis-avsession.md b/zh-cn/application-dev/reference/apis/js-apis-avsession.md index 2c34a0244668b9b6bd9df550d095a47218f93f2d..f57f581a3509ef8dd861c9e3e858664f0ceab81b 100755 --- a/zh-cn/application-dev/reference/apis/js-apis-avsession.md +++ b/zh-cn/application-dev/reference/apis/js-apis-avsession.md @@ -978,9 +978,9 @@ setLaunchAbility(ability: WantAgent): Promise\ **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| ------- | --------------------------------- | ---- | ----------------------------------------------------------- | -| ability | [WantAgent](js-apis-wantAgent.md) | 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 | +| 参数名 | 类型 | 必填 | 说明 | +| ------- | --------------------------------------------- | ---- | ----------------------------------------------------------- | +| ability | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 | **返回值:** @@ -1048,10 +1048,10 @@ setLaunchAbility(ability: WantAgent, callback: AsyncCallback\): void **参数:** -| 参数名 | 类型 | 必填 | 说明 | -| -------- | --------------------------------- | ---- | ----------------------------------------------------------- | -| ability | [WantAgent](js-apis-wantAgent.md) | 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 | -| callback | AsyncCallback | 是 | 回调函数。当Ability设置成功,err为undefined,否则返回错误对象。 | +| 参数名 | 类型 | 必填 | 说明 | +| -------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | +| ability | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 应用的相关属性信息,如bundleName,abilityName,deviceId等。 | +| callback | AsyncCallback | 是 | 回调函数。当Ability设置成功,err为undefined,否则返回错误对象。 | **错误码:** 以下错误码的详细介绍请参见[ohos.multimedia.avsession(多媒体会话)错误码](../errorcodes/errorcode-avsession.md)。 @@ -2204,9 +2204,9 @@ getLaunchAbility(): Promise\ **返回值:** -| 类型 | 说明 | -| ------------------------------------------- | ------------------------------------------------------------ | -| 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)。 @@ -2239,9 +2239,9 @@ getLaunchAbility(callback: AsyncCallback\): 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)。 diff --git a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md index 4b7b1d0524e8154bfeee78a04bde821b5ae59cce..b89e4400faec9c90601181d933e120a1a094e638 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-backgroundTaskManager.md @@ -159,12 +159,12 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want **参数**: -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | -| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | -| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | -| callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击后跳转的界面。 | +| callback | AsyncCallback<void> | 是 | callback形式返回启动长时任务的结果。 | **示例**: @@ -251,11 +251,11 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want **参数**: -| 参数名 | 类型 | 必填 | 说明 | -| --------- | ---------------------------------- | ---- | ---------------------------------------- | -| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | -| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | -| wantAgent | [WantAgent](js-apis-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | +| 参数名 | 类型 | 必填 | 说明 | +| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | +| context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
Stage模型的应用Context定义见[Context](js-apis-ability-context.md)。 | +| bgMode | [BackgroundMode](#backgroundmode8) | 是 | 向系统申请的后台模式。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | **返回值**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md index 7228bf96d4552040fc72de80826c082076802b14..3f0d49e87c3a5b80e9ccbfa002caab0de4ce0e9e 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md +++ b/zh-cn/application-dev/reference/apis/js-apis-inner-wantAgent-wantAgentInfo.md @@ -9,5 +9,5 @@ | wants | Array\ | 是 | 将被执行的动作列表。 | | operationType | wantAgent.OperationType | 是 | 动作类型。 | | requestCode | number | 是 | 使用者定义的一个私有值。 | -| wantAgentFlags | Array<[wantAgent.WantAgentFlags](js-apis-wantAgent.md#WantAgentFlags)> | 否 | 动作执行属性。 | +| wantAgentFlags | Array<[wantAgent.WantAgentFlags](js-apis-app-ability-wantAgent.md#wantagentflags)> | 否 | 动作执行属性。 | | extraInfo | {[key: string]: any} | 否 | 额外数据。 | diff --git a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md index a9b0d71a042853ab4198ac9e72f9322d040b4584..266497bac93f50fe51651ab7d9576e2967de20e5 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md @@ -235,7 +235,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want | --------- | ---------------------------------- | ---- | ---------------------------------------- | | context | Context | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
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 | 是 | 应用运行的上下文。
FA模型的应用Context定义见[Context](js-apis-inner-app-context.md)。
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) | 是 | 通知参数,用于指定长时任务通知点击跳转的界面。 | **返回值**: diff --git a/zh-cn/application-dev/reference/apis/js-apis-system-timer.md b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md index f1cec2767a38bc5aaac708ff18a877054b09764a..05105ecb1c6b298b97d2dd14468982050724c13b 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-system-timer.md +++ b/zh-cn/application-dev/reference/apis/js-apis-system-timer.md @@ -33,13 +33,13 @@ import systemTimer from '@ohos.systemTimer'; **系统能力:** SystemCapability.MiscServices.Time -| 名称 | 类型 | 必填 | 说明 | -| --------- | --------------------------------- | ---- | ------------------------------------------------------------ | -| type | number | 是 | 定时器类型。
取值为1时,表示为系统启动时间定时器(定时器启动时间不能晚于当前设置的系统时间) ;
取值为2时,表示为唤醒定时器;
取值为4时,表示为精准定时器;
取值为5时,表示为IDLE模式定时器(暂不支持)。 | -| repeat | boolean | 是 | true为循环定时器,false为单次定时器。 | -| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 | -| wantAgent | [WantAgent](js-apis-wantAgent.md) | 否 | 设置通知的WantAgent,定时器到期后通知。(支持拉起应用MainAbility,暂不支持拉起ServiceAbility。) | -| callback | number | 是 | 以回调函数的形式返回定时器的ID。 | +| 名称 | 类型 | 必填 | 说明 | +| --------- | --------------------------------------------- | ---- | ------------------------------------------------------------ | +| type | number | 是 | 定时器类型。
取值为1时,表示为系统启动时间定时器(定时器启动时间不能晚于当前设置的系统时间) ;
取值为2时,表示为唤醒定时器;
取值为4时,表示为精准定时器;
取值为5时,表示为IDLE模式定时器(暂不支持)。 | +| repeat | boolean | 是 | true为循环定时器,false为单次定时器。 | +| interval | number | 否 | 如果是循环定时器,repeat值应大于5000毫秒,非重复定时器置为0。 | +| wantAgent | [WantAgent](js-apis-app-ability-wantAgent.md) | 否 | 设置通知的WantAgent,定时器到期后通知。(支持拉起应用MainAbility,暂不支持拉起ServiceAbility。) | +| callback | number | 是 | 以回调函数的形式返回定时器的ID。 | ## systemTimer.createTimer diff --git a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md index 00eae0c2c49def55828413f925748b29b8feb893..f55d0a112346c0e6b9145ad149c51b5589b80d89 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md +++ b/zh-cn/application-dev/reference/apis/js-apis-wantAgent.md @@ -227,7 +227,6 @@ getBundleName(agent: WantAgent): Promise\ ```js import WantAgent from '@ohos.wantAgent'; - //wantAgent对象 var wantAgent; diff --git a/zh-cn/application-dev/task-management/continuous-task-dev-guide.md b/zh-cn/application-dev/task-management/continuous-task-dev-guide.md index dd6c4ee9da00dab13a49e4ac2cef1e1bf2e35e88..632cacbce5f90b7cdfceeff4efb10076d7086b1d 100644 --- a/zh-cn/application-dev/task-management/continuous-task-dev-guide.md +++ b/zh-cn/application-dev/task-management/continuous-task-dev-guide.md @@ -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** 后台模式类型