Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
cbdbaf6e
D
Docs
项目概览
OpenHarmony
/
Docs
大约 2 年 前同步成功
通知
161
Star
293
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看板
未验证
提交
cbdbaf6e
编写于
8月 03, 2023
作者:
N
ningning
提交者:
Gitee
8月 03, 2023
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
update zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md.
Signed-off-by:
N
ningning
<
wangningning14@huawei.com
>
上级
48cdb4e4
变更
1
显示空白变更内容
内联
并排
Showing
1 changed file
with
53 addition
and
53 deletion
+53
-53
zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
...ce/apis/js-apis-resourceschedule-backgroundTaskManager.md
+53
-53
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-resourceschedule-backgroundTaskManager.md
浏览文件 @
cbdbaf6e
...
@@ -11,6 +11,7 @@
...
@@ -11,6 +11,7 @@
对于系统特权应用,提供独立的能效资源申请接口。系统特权应用如果需要使用特定的系统资源,例如在被挂起期间仍然能够收到系统公共事件,可以使用能效资源申请接口。
对于系统特权应用,提供独立的能效资源申请接口。系统特权应用如果需要使用特定的系统资源,例如在被挂起期间仍然能够收到系统公共事件,可以使用能效资源申请接口。
> **说明:**
> **说明:**
>
> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
> - 本模块首批接口从API version 9开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。
...
@@ -24,9 +25,11 @@ import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'
...
@@ -24,9 +25,11 @@ import backgroundTaskManager from '@ohos.resourceschedule.backgroundTaskManager'
requestSuspendDelay(reason: string, callback: Callback
<
void
>
): DelaySuspendInfo
requestSuspendDelay(reason: string, callback: Callback
<
void
>
): DelaySuspendInfo
后台应用
申请延迟挂起。
申请延迟挂起。
延迟挂起时间一般情况下默认值为3分钟,低电量(依据系统低电量广播)时默认值为1分钟。
> **说明:**
>
> 延迟挂起时间最长为3分钟,[低电量](js-apis-battery-info.md)时最长为1分钟。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
...
@@ -34,7 +37,7 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
...
@@ -34,7 +37,7 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | -------------------- | ---- | ------------------------------ |
| -------- | -------------------- | ---- | ------------------------------ |
| reason | string | 是 |
延迟挂起申请
的原因。 |
| reason | string | 是 |
申请延迟挂起
的原因。 |
| callback | Callback
<
void
>
| 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 |
| callback | Callback
<
void
>
| 是 | 延迟即将超时的回调函数,一般在超时前6秒通过此回调通知应用。 |
**返回值**
:
**返回值**
:
...
@@ -45,7 +48,7 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
...
@@ -45,7 +48,7 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -80,7 +83,8 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
...
@@ -80,7 +83,8 @@ requestSuspendDelay(reason: string, callback: Callback<void>): DelaySuspen
getRemainingDelayTime(requestId: number, callback: AsyncCallback
<
number
>
): void
getRemainingDelayTime(requestId: number, callback: AsyncCallback
<
number
>
): void
获取应用程序进入挂起状态前的剩余时间,使用callback形式返回。
获取延迟挂起的剩余时间。使用callback形式返回。
//// 参考最新开发指南,进行修改
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
...
@@ -89,11 +93,11 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>):
...
@@ -89,11 +93,11 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>):
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| --------- | --------------------------- | ---- | ---------------------------------------- |
| --------- | --------------------------- | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| callback | AsyncCallback
<
number
>
| 是 |
指定的callback回调方法。用于返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位
。 |
| callback | AsyncCallback
<
number
>
| 是 |
回调函数,返回本次延迟挂起的剩余时间,单位为毫秒
。 |
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -129,9 +133,7 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>):
...
@@ -129,9 +133,7 @@ getRemainingDelayTime(requestId: number, callback: AsyncCallback<number>):
getRemainingDelayTime(requestId: number): Promise
<
number
>
getRemainingDelayTime(requestId: number): Promise
<
number
>
获取应用程序进入挂起状态前的剩余时间,使用Promise形式返回。
获取延迟挂起的剩余时间。使用Promise形式返回。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.TransientTask
...
@@ -145,11 +147,11 @@ getRemainingDelayTime(requestId: number): Promise<number>
...
@@ -145,11 +147,11 @@ getRemainingDelayTime(requestId: number): Promise<number>
| 类型 | 说明 |
| 类型 | 说明 |
| --------------------- | ---------------------------------------- |
| --------------------- | ---------------------------------------- |
| Promise
<
number
>
| 指定的Promise回调方法
。返回应用程序进入挂起状态之前的剩余时间,以毫秒为单位
。 |
| Promise
<
number
>
| 指定的Promise回调方法
,回调函数,返回本次延迟挂起的剩余时间,单位为毫秒
。 |
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -194,7 +196,7 @@ cancelSuspendDelay(requestId: number): void
...
@@ -194,7 +196,7 @@ cancelSuspendDelay(requestId: number): void
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -223,7 +225,7 @@ cancelSuspendDelay(requestId: number): void
...
@@ -223,7 +225,7 @@ cancelSuspendDelay(requestId: number): void
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback
<
void
>
): void
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent, callback: AsyncCallback
<
void
>
): void
向系统
申请长时任务,使用callback形式返回结果。
申请长时任务,使用callback形式返回结果。
**需要权限:**
ohos.permission.KEEP_BACKGROUND_RUNNING
**需要权限:**
ohos.permission.KEEP_BACKGROUND_RUNNING
...
@@ -234,13 +236,13 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
...
@@ -234,13 +236,13 @@ 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-inner-application-context.md
)
。 |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-inner-application-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 |
向系统申请的
后台模式。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 | 后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定
长时任务通知点击后跳转的界面。
|
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定
点击长时任务通知点击后跳转的界面。
|
| callback | AsyncCallback
<
void
>
| 是 |
callback形式返回启动长时任务的
结果。 |
| callback | AsyncCallback
<
void
>
| 是 |
回调函数,返回长时任务的启动
结果。 |
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -301,7 +303,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -301,7 +303,7 @@ export default class EntryAbility extends UIAbility {
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise
<
void
>
startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: WantAgent): Promise
<
void
>
向系统
申请长时任务,使用promise形式返回结果。
申请长时任务,使用promise形式返回结果。
**需要权限:**
ohos.permission.KEEP_BACKGROUND_RUNNING
**需要权限:**
ohos.permission.KEEP_BACKGROUND_RUNNING
...
@@ -312,8 +314,8 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
...
@@ -312,8 +314,8 @@ 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-inner-application-context.md
)
。 |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-inner-application-context.md
)
。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 |
向系统申请的
后台模式。 |
| bgMode |
[
BackgroundMode
](
#backgroundmode
)
| 是 | 后台模式。 |
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定
长时任务通知点击
跳转的界面。 |
| wantAgent |
[
WantAgent
](
js-apis-app-ability-wantAgent.md
)
| 是 | 通知参数,用于指定
点击长时任务通知后
跳转的界面。 |
**返回值**
:
**返回值**
:
...
@@ -323,7 +325,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
...
@@ -323,7 +325,7 @@ startBackgroundRunning(context: Context, bgMode: BackgroundMode, wantAgent: Want
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -380,7 +382,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -380,7 +382,7 @@ export default class EntryAbility extends UIAbility {
stopBackgroundRunning(context: Context, callback: AsyncCallback
<
void
>
): void
stopBackgroundRunning(context: Context, callback: AsyncCallback
<
void
>
): void
向系统申请
取消长时任务,使用callback形式返回结果。
取消长时任务,使用callback形式返回结果。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
...
@@ -389,11 +391,11 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo
...
@@ -389,11 +391,11 @@ stopBackgroundRunning(context: Context, callback: AsyncCallback<void>): vo
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| -------- | ------------------------- | ---- | ---------------------------------------- |
| -------- | ------------------------- | ---- | ---------------------------------------- |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-inner-application-context.md
)
。 |
| context | Context | 是 | 应用运行的上下文。
<br>
FA模型的应用Context定义见
[
Context
](
js-apis-inner-app-context.md
)
。
<br>
Stage模型的应用Context定义见
[
Context
](
js-apis-inner-application-context.md
)
。 |
| callback | AsyncCallback
<
void
>
| 是 |
callback形式返回启动长时任务的结果。
|
| callback | AsyncCallback
<
void
>
| 是 |
回调函数,返回长时任务的取消结果。
|
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -434,9 +436,7 @@ export default class EntryAbility extends UIAbility {
...
@@ -434,9 +436,7 @@ export default class EntryAbility extends UIAbility {
stopBackgroundRunning(context: Context): Promise
<
void
>
stopBackgroundRunning(context: Context): Promise
<
void
>
向系统申请取消长时任务,使用promise形式返回结果。
取消长时任务,使用promise形式返回结果。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
...
@@ -454,7 +454,7 @@ stopBackgroundRunning(context: Context): Promise<void>
...
@@ -454,7 +454,7 @@ stopBackgroundRunning(context: Context): Promise<void>
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -489,10 +489,9 @@ export default class EntryAbility extends UIAbility {
...
@@ -489,10 +489,9 @@ export default class EntryAbility extends UIAbility {
## backgroundTaskManager.applyEfficiencyResources
## backgroundTaskManager.applyEfficiencyResources
applyEfficiencyResources(request:
[
EfficiencyResourcesRequest
](
#efficiencyresourcesrequest
)
): void
applyEfficiencyResources(request:
EfficiencyResourcesRequest
): void
向系统申请能效资源。
申请能效资源。
进程和它所属的应用可以同时申请某一类资源,例如CPU资源,但是应用释放资源的时候会将进程的资源一起释放。
**系统能力**
: SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
**系统能力**
: SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
...
@@ -502,12 +501,12 @@ applyEfficiencyResources(request: [EfficiencyResourcesRequest](#efficiencyresour
...
@@ -502,12 +501,12 @@ applyEfficiencyResources(request: [EfficiencyResourcesRequest](#efficiencyresour
| 参数名 | 类型 | 必填 | 说明 |
| 参数名 | 类型 | 必填 | 说明 |
| ------- | ------- | ---- | ---------------------------------------- |
| ------- | ------- | ---- | ---------------------------------------- |
| request |
[
EfficiencyResourcesRequest
](
#efficiencyresourcesrequest
)
| 是 | 请求的必要信息
。包括资源类型,超时时间等信息。详见
[
EfficiencyResourcesRequest
](
#efficiencyresourcesrequest
)
。 |
| request |
[
EfficiencyResourcesRequest
](
#efficiencyresourcesrequest
)
| 是 | 请求的必要信息
,包括资源类型,超时时间等信息
。 |
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -542,7 +541,7 @@ try {
...
@@ -542,7 +541,7 @@ try {
resetAllEfficiencyResources(): void
resetAllEfficiencyResources(): void
释放
所有已经申请的
资源。
释放
全部能效
资源。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.EfficiencyResourcesApply
...
@@ -550,7 +549,7 @@ resetAllEfficiencyResources(): void
...
@@ -550,7 +549,7 @@ resetAllEfficiencyResources(): void
**错误码**
:
**错误码**
:
以下错误码的详细介绍请参见
[
@ohos.resourceschedule.backgroundTaskManager (后台任务管理)
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
以下错误码的详细介绍请参见
[
backgroundTaskManager错误码
](
../errorcodes/errorcode-backgroundTaskMgr.md
)
错误码。
| 错误码ID | 错误信息 |
| 错误码ID | 错误信息 |
| ---- | --------------------- |
| ---- | --------------------- |
...
@@ -581,11 +580,12 @@ try {
...
@@ -581,11 +580,12 @@ try {
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| --------------- | ------ | ---- | ---------------------------------------- |
| --------------- | ------ | ---- | ---------------------------------------- |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| requestId | number | 是 | 延迟挂起的请求ID。 |
| actualDelayTime | number | 是 | 应用的实际挂起延迟时间,以毫秒为单位。
<br/>
一般情况下默认值为180000,低电量(依据系统低电量广播)时默认值为60000。 |
| actualDelayTime | number | 是 | 应用实际的延迟挂起时间,单位为毫秒。
<br/>
延迟挂起时间最长为3分钟,
[
低电量
](
js-apis-battery-info.md
)
时最长为1分钟。 |
## BackgroundMode
## BackgroundMode
后台任务模式。
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
**系统能力:**
SystemCapability.ResourceSchedule.BackgroundTaskManager.ContinuousTask
| 名称 | 值 | 说明 |
| 名称 | 值 | 说明 |
...
@@ -596,9 +596,9 @@ try {
...
@@ -596,9 +596,9 @@ try {
| LOCATION | 4 | 定位导航。 |
| LOCATION | 4 | 定位导航。 |
| BLUETOOTH_INTERACTION | 5 | 蓝牙相关。 |
| BLUETOOTH_INTERACTION | 5 | 蓝牙相关。 |
| MULTI_DEVICE_CONNECTION | 6 | 多设备互联。 |
| MULTI_DEVICE_CONNECTION | 6 | 多设备互联。 |
| WIFI_INTERACTION | 7 | WLAN相关(
此接口为系统接口
)。 |
| WIFI_INTERACTION | 7 | WLAN相关(
仅对系统应用开放
)。 |
| VOIP | 8 | 音视频通话(
此接口为系统接口
)。 |
| VOIP | 8 | 音视频通话(
仅对系统应用开放
)。 |
| TASK_KEEPING | 9 | 计算任务(仅
在特定设备生效
)。 |
| TASK_KEEPING | 9 | 计算任务(仅
对特定设备开放
)。 |
## EfficiencyResourcesRequest
## EfficiencyResourcesRequest
...
@@ -611,11 +611,11 @@ try {
...
@@ -611,11 +611,11 @@ try {
| 名称 | 类型 | 必填 | 说明 |
| 名称 | 类型 | 必填 | 说明 |
| --------------- | ------ | ---- | ---------------------------------------- |
| --------------- | ------ | ---- | ---------------------------------------- |
| resourceTypes | number | 是 | 申请的资源类型。 |
| resourceTypes | number | 是 | 申请的资源类型。 |
| isApply | boolean | 是 | 申请
资源或者是释放资源。
|
| isApply | boolean | 是 | 申请
或释放资源。
<br>
- true表示申请资源,false表示释放部分资源。
|
| timeOut | number | 是 | 资源
的使用时间,以毫秒为单位
。 |
| timeOut | number | 是 | 资源
使用时间,单位为毫秒
。 |
| isPersist | boolean | 否 | 是否永久持有资源,
如果是true,那么timeOut就无效。
|
| isPersist | boolean | 否 | 是否永久持有资源,
默认为false。
<br>
- true表示永久持有,false表示有限时间内持有。
|
| isProcess | boolean | 否 |
应用申请或者是进程申请。
|
| isProcess | boolean | 否 |
进程或应用申请,默认为false。
<br>
- true表示进程申请,false表示应用申请。
|
| reason | string | 是 | 申请资源
的
原因。 |
| reason | string | 是 | 申请资源原因。 |
## ResourceType
## ResourceType
...
@@ -627,12 +627,12 @@ try {
...
@@ -627,12 +627,12 @@ try {
| 名称 | 值 | 说明 |
| 名称 | 值 | 说明 |
| ----------------------- | ---- | --------------------- |
| ----------------------- | ---- | --------------------- |
| CPU | 1 | CPU资源,申请后不被挂起。 |
| CPU | 1 | CPU资源,申请后
应用进程
不被挂起。 |
| COMMON_EVENT | 2 |
申请后挂起状态下不会代理
公共事件。 |
| COMMON_EVENT | 2 |
公共事件资源,申请后应用进程被挂起后,可以收到
公共事件。 |
| TIMER | 4 | 计时器,申请后
挂起状态不会代理SystemTimer
。 |
| TIMER | 4 | 计时器,申请后
应用进程被挂起后,Timer仍然可以唤醒应用
。 |
| WORK_SCHEDULER | 8 |
[
WorkScheduler默认采用较宽松管控策略。(详见 延迟任务调度约束)
](
../../task-management/background-task-overview.md#延迟任务调度约束
)
|
| WORK_SCHEDULER | 8 |
延迟任务资源,申请后延迟任务管控变宽松。
|
| BLUETOOTH | 16 |
申请后挂起状态不会代理蓝牙
。 |
| BLUETOOTH | 16 |
蓝牙资源,申请后应用进程被挂起后,蓝牙相关事件仍然可以唤醒应用
。 |
| GPS | 32 |
申请后挂起状态不会代理GPS
。 |
| GPS | 32 |
GPS资源,申请后应用进程被挂起后,GPS相关事件可以唤醒应用
。 |
| AUDIO | 64 |
申请后挂起状态不会代理音频
。 |
| AUDIO | 64 |
音频资源,有音频播放时对应的应用进程不被挂起
。 |
| RUNNING_LOCK
<sup>
10+
</sup>
| 128 | RUNNING_LOCK资源,申请后挂起状态不会代理RUNNING_BACKGROUND锁。 |
| RUNNING_LOCK
<sup>
10+
</sup>
| 128 | RUNNING_LOCK资源,申请后挂起状态不会代理RUNNING_BACKGROUND锁。 |
| SENSOR
<sup>
10+
</sup>
| 256 | 申请后不拦截Sensor回调。 |
| SENSOR
<sup>
10+
</sup>
| 256 | 申请后不拦截Sensor回调。 |
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录