Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
6b5cc367
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看板
未验证
提交
6b5cc367
编写于
1月 06, 2023
作者:
O
openharmony_ci
提交者:
Gitee
1月 06, 2023
浏览文件
操作
浏览文件
下载
差异文件
!13023 【元能力】abilityManager、appManager错误码
Merge pull request !13023 from donglin/master
上级
bed6fb79
5f5dffa9
变更
10
展开全部
隐藏空白更改
内联
并排
Showing
10 changed file
with
603 addition
and
162 deletion
+603
-162
zh-cn/application-dev/reference/apis/js-apis-ability-context.md
...application-dev/reference/apis/js-apis-ability-context.md
+56
-28
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
...dev/reference/apis/js-apis-app-ability-abilityConstant.md
+10
-10
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md
...ence/apis/js-apis-app-ability-abilityDelegatorRegistry.md
+5
-6
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md
...ence/apis/js-apis-app-ability-abilityLifecycleCallback.md
+92
-16
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
...-dev/reference/apis/js-apis-app-ability-abilityManager.md
+120
-40
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityStage.md
...on-dev/reference/apis/js-apis-app-ability-abilityStage.md
+8
-0
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
...tion-dev/reference/apis/js-apis-app-ability-appManager.md
+268
-49
zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
...ion-dev/reference/apis/js-apis-app-ability-appRecovery.md
+28
-5
zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
...ation-dev/reference/apis/js-apis-app-ability-uiAbility.md
+10
-5
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
...n-dev/reference/apis/js-apis-inner-application-context.md
+6
-3
未找到文件。
zh-cn/application-dev/reference/apis/js-apis-ability-context.md
浏览文件 @
6b5cc367
...
...
@@ -59,7 +59,8 @@ startAbility(want: Want, callback: AsyncCallback<void>): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -114,7 +115,8 @@ startAbility(want: Want, options: StartOptions, callback: AsyncCallback<void&
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -177,7 +179,8 @@ startAbility(want: Want, options?: StartOptions): Promise<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -234,7 +237,8 @@ startAbilityForResult(want: Want, callback: AsyncCallback<AbilityResult>):
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -290,7 +294,8 @@ startAbilityForResult(want: Want, options: StartOptions, callback: AsyncCallback
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -356,7 +361,8 @@ startAbilityForResult(want: Want, options?: StartOptions): Promise<AbilityRes
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -417,7 +423,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, callback: AsyncC
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -480,7 +487,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options: StartOp
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -551,7 +559,8 @@ startAbilityForResultWithAccount(want: Want, accountId: number, options?: StartO
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -606,7 +615,8 @@ startServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -656,7 +666,8 @@ startServiceExtensionAbility(want: Want): Promise\<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -710,7 +721,8 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -764,7 +776,8 @@ startServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -815,7 +828,8 @@ stopServiceExtensionAbility(want: Want, callback: AsyncCallback\<void>): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -871,7 +885,8 @@ stopServiceExtensionAbility(want: Want): Promise\<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -931,7 +946,8 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number, callback:
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -991,7 +1007,8 @@ stopServiceExtensionAbilityWithAccount(want: Want, accountId: number): Promise\<
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1046,7 +1063,8 @@ terminateSelf(callback: AsyncCallback<void>): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1083,7 +1101,8 @@ terminateSelf(): Promise<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1119,7 +1138,8 @@ terminateSelfWithResult(parameter: AbilityResult, callback: AsyncCallback<voi
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1180,7 +1200,8 @@ terminateSelfWithResult(parameter: AbilityResult): Promise<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1243,7 +1264,8 @@ connectServiceExtensionAbility(want: Want, options: ConnectOptions): number;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1301,7 +1323,8 @@ connectServiceExtensionAbilityWithAccount(want: Want, accountId: number, options
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1353,7 +1376,8 @@ disconnectServiceExtensionAbility(connection: number): Promise\<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1399,7 +1423,8 @@ disconnectServiceExtensionAbility(connection: number, callback:AsyncCallback\<vo
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1549,7 +1574,8 @@ startAbilityWithAccount(want: Want, accountId: number, callback: AsyncCallback\<
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1611,7 +1637,8 @@ startAbilityWithAccount(want: Want, accountId: number, options: StartOptions, ca
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -1675,7 +1702,8 @@ startAbilityWithAccount(want: Want, accountId: number, options?: StartOptions):
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityConstant.md
浏览文件 @
6b5cc367
...
...
@@ -43,11 +43,11 @@ Ability初次启动原因,该类型为枚举,可配合[Ability](js-apis-app-
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
if
(
launch
erParam
.
launchReason
==
AbilityConstant
.
LaunchReason
.
START_ABILITY
)
{
if
(
launch
Param
.
launchReason
=
==
AbilityConstant
.
LaunchReason
.
START_ABILITY
)
{
console
.
log
(
"
The ability has been started by the way of startAbility.
"
);
}
}
...
...
@@ -69,11 +69,11 @@ Ability上次退出原因,该类型为枚举,可配合[Ability](js-apis-app-
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onCreate
(
want
,
launchParam
)
{
if
(
launch
erParam
.
lastExitReason
==
AbilityConstant
.
LastExitReason
.
ABILITY_NOT_RESPONDING
)
{
if
(
launch
Param
.
lastExitReason
=
==
AbilityConstant
.
LastExitReason
.
ABILITY_NOT_RESPONDING
)
{
console
.
log
(
"
The ability has exit last because the ability was not responding.
"
);
}
}
...
...
@@ -95,7 +95,7 @@ Ability迁移结果,该类型为枚举,可配合[Ability](js-apis-app-abilit
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onContinue
(
wantParam
)
{
...
...
@@ -152,11 +152,11 @@ this.context.startAbility(want, option).then(()={
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onMemoryLevel
(
level
)
{
if
(
level
==
AbilityConstant
.
MemoryLevel
.
MEMORY_LEVEL_CRITICAL
)
{
if
(
level
==
=
AbilityConstant
.
MemoryLevel
.
MEMORY_LEVEL_CRITICAL
)
{
console
.
log
(
"
The memory of device is critical, please release some memory.
"
);
}
}
...
...
@@ -181,7 +181,7 @@ class MyAbility extends UIAbility {
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onSaveState
(
reason
,
wantParam
)
{
...
...
@@ -204,11 +204,11 @@ class MyAbility extends UIAbility {
**示例:**
```
ts
import
UIAbility
f
or
m
'
@ohos.app.ability.UIAbility
'
;
import
UIAbility
f
ro
m
'
@ohos.app.ability.UIAbility
'
;
class
MyAbility
extends
UIAbility
{
onSaveState
(
reason
,
wantParam
)
{
if
(
reason
==
AbilityConstant
.
StateType
.
CONTINUATION
)
{
if
(
reason
==
=
AbilityConstant
.
StateType
.
CONTINUATION
)
{
console
.
log
(
"
Save the ability data when the ability continuation.
"
);
}
return
AbilityConstant
.
OnSaveResult
.
ALL_AGREE
;
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityDelegatorRegistry.md
浏览文件 @
6b5cc367
...
...
@@ -46,15 +46,14 @@ getAbilityDelegator(): AbilityDelegator
```
ts
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
var
abilityDelegator
;
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
abilityDelegator
=
AbilityDelegatorRegistry
.
getAbilityDelegator
();
let
want
=
{
bundleName
:
"
com.ohos.example
"
,
abilityName
:
"
MainAbility
"
}
abilityDelegator
.
startAbility
(
want
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
}
;
abilityDelegator
.
startAbility
(
want
,
(
err
)
=>
{
if
(
err
.
code
!=
=
0
)
{
console
.
log
(
"
Success start ability.
"
);
}
else
{
console
.
log
(
"
Failed start ability, error:
"
+
JSON
.
stringify
(
err
));
...
...
@@ -81,7 +80,7 @@ getArguments(): AbilityDelegatorArgs
```
ts
import
AbilityDelegatorRegistry
from
'
@ohos.app.ability.abilityDelegatorRegistry
'
;
var
args
=
AbilityDelegatorRegistry
.
getArguments
();
let
args
=
AbilityDelegatorRegistry
.
getArguments
();
console
.
info
(
"
getArguments bundleName:
"
+
args
.
bundleName
);
console
.
info
(
"
getArguments parameters:
"
+
JSON
.
stringify
(
args
.
parameters
));
console
.
info
(
"
getArguments testCaseNames:
"
+
args
.
testCaseNames
);
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityLifecycleCallback.md
浏览文件 @
6b5cc367
...
...
@@ -29,6 +29,14 @@ onAbilityCreate(ability: UIAbility): void;
| -------- | -------- | -------- | -------- |
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onAbilityCreate
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityCreate.
"
);
}
};
```
## AbilityLifecycleCallback.onWindowStageCreate
...
...
@@ -45,6 +53,14 @@ onWindowStageCreate(ability: UIAbility, windowStage: window.WindowStage): void;
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
| windowStage |
[
window.WindowStage
](
js-apis-window.md#windowstage9
)
| 是 | 当前WindowStage对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onWindowStageCreate
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageCreate.
"
);
}
};
```
## AbilityLifecycleCallback.onWindowStageActive
...
...
@@ -61,6 +77,14 @@ onWindowStageActive(ability: UIAbility, windowStage: window.WindowStage): void;
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
| windowStage |
[
window.WindowStage
](
js-apis-window.md#windowstage9
)
| 是 | 当前WindowStage对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onWindowStageActive
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageActive.
"
);
}
};
```
## AbilityLifecycleCallback.onWindowStageInactive
...
...
@@ -77,6 +101,14 @@ onWindowStageInactive(ability: UIAbility, windowStage: window.WindowStage): void
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
| windowStage |
[
window.WindowStage
](
js-apis-window.md#windowstage9
)
| 是 | 当前WindowStage对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onWindowStageInactive
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageInactive.
"
);
}
};
```
## AbilityLifecycleCallback.onWindowStageDestroy
...
...
@@ -93,6 +125,14 @@ onWindowStageDestroy(ability: UIAbility, windowStage: window.WindowStage): void;
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
| windowStage |
[
window.WindowStage
](
js-apis-window.md#windowstage9
)
| 是 | 当前WindowStage对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onWindowStageDestroy
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageDestroy.
"
);
}
};
```
## AbilityLifecycleCallback.onAbilityDestroy
...
...
@@ -108,6 +148,14 @@ onAbilityDestroy(ability: UIAbility): void;
| -------- | -------- | -------- | -------- |
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onAbilityDestroy
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityDestroy.
"
);
}
};
```
## AbilityLifecycleCallback.onAbilityForeground
...
...
@@ -123,6 +171,14 @@ onAbilityForeground(ability: UIAbility): void;
| -------- | -------- | -------- | -------- |
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onAbilityForeground
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityForeground.
"
);
}
};
```
## AbilityLifecycleCallback.onAbilityBackground
...
...
@@ -138,6 +194,14 @@ onAbilityBackground(ability: UIAbility): void;
| -------- | -------- | -------- | -------- |
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onAbilityBackground
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityBackground.
"
);
}
};
```
## AbilityLifecycleCallback.onAbilityContinue
...
...
@@ -153,45 +217,57 @@ onAbilityContinue(ability: UIAbility): void;
| -------- | -------- | -------- | -------- |
| ability |
[
UIAbility
](
js-apis-app-ability-uiAbility.md
)
| 是 | 当前Ability对象 |
**示例:**
```
ts
let
abilityLifecycleCallback
=
{
onAbilityContinue
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityContinue.
"
);
}
};
```
## AbilityLifecycleCallback使用
**示例:**
My
AbilityStage
.ts
My
FirstAbility
.ts
```
ts
import
AbilityLifecycleCallback
from
"
@ohos.app.ability.AbilityLifecycleCallback
"
;
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
import
AbilityStage
from
"
@ohos.app.ability.AbilityStage
"
;
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
// 声明ability生命周期回调
let
abilityLifecycleCallback
=
{
// 声明ability生命周期回调
,需配置所有回调后才可以在applicationContext注册
let
abilityLifecycleCallback
=
{
onAbilityCreate
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityCreate.
"
);
console
.
log
(
"
AbilityLifecycleCallback onAbilityCreate.
"
);
},
onWindowStageCreate
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageCreate.
"
);
console
.
log
(
"
AbilityLifecycleCallback onWindowStageCreate.
"
);
},
onWindowStageActive
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageActive.
"
);
console
.
log
(
"
AbilityLifecycleCallback onWindowStageActive.
"
);
},
onWindowStageInactive
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageInactive.
"
);
},
onWindowStageDestroy
(
ability
,
windowStage
){
console
.
log
(
"
AbilityLifecycleCallback onWindowStageDestroy.
"
);
console
.
log
(
"
AbilityLifecycleCallback onWindowStageDestroy.
"
);
},
onAbilityDestroy
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityDestroy.
"
);
console
.
log
(
"
AbilityLifecycleCallback onAbilityDestroy.
"
);
},
onAbilityForeground
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityForeground.
"
);
console
.
log
(
"
AbilityLifecycleCallback onAbilityForeground.
"
);
},
onAbilityBackground
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityBackground.
"
);
console
.
log
(
"
AbilityLifecycleCallback onAbilityBackground.
"
);
},
onAbilityContinue
(
ability
){
console
.
log
(
"
AbilityLifecycleCallback onAbilityContinue.
"
);
}
}
}
;
export
default
class
My
AbilityStage
extends
AbilityStage
{
export
default
class
My
FirstAbility
extends
UIAbility
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage onCreate
"
);
// 1.通过context属性获取applicationContext
...
...
@@ -207,11 +283,11 @@ export default class MyAbilityStage extends AbilityStage {
}
```
MyAbility.ts
My
Second
Ability.ts
```
ts
import
UIAbility
from
"
ohos.app.ability.UIAbility
"
import
UIAbility
from
"
ohos.app.ability.UIAbility
"
;
export
default
class
MyAbility
extends
UIAbility
{
export
default
class
My
Second
Ability
extends
UIAbility
{
onDestroy
()
{
let
applicationContext
=
this
.
context
.
getApplicationContext
();
// 3.通过applicationContext注销监听应用内生命周期
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityManager.md
浏览文件 @
6b5cc367
...
...
@@ -10,7 +10,7 @@ AbilityManager模块提供获取、新增、修改Ability相关信息和状态
## 导入模块
```
ts
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
```
## AbilityState
...
...
@@ -46,29 +46,39 @@ updateConfiguration(config: Configuration, callback: AsyncCallback\<void>): void
| config |
[
Configuration
](
js-apis-app-ability-configuration.md
)
| 是 | 新的配置项,仅需配置需要更新的项。 |
| callback | AsyncCallback
\<
void> | 是 | 以回调方式返回接口运行结果,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
var
config
=
{
language
:
'
Zh-Hans
'
,
colorMode
:
COLOR_MODE_LIGHT
,
direction
:
DIRECTION_VERTICAL
,
screenDensity
:
SCREEN_DENSITY_SDPI
,
displayId
:
1
,
hasPointerDevice
:
true
,
}
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
const
config
=
{
language
:
'
Zh-Hans
'
,
// 简体中文
colorMode
:
COLOR_MODE_LIGHT
,
// 浅色模式
direction
:
DIRECTION_VERTICAL
,
// 垂直方向
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕分辨率为"sdpi"
displayId
:
1
,
// 应用在Id为1的物理屏上显示
hasPointerDevice
:
true
,
// 指针类型设备已连接
};
try
{
abilityManager
.
updateConfiguration
(
config
,
(
err
)
=>
{
if
(
err
.
code
!=
0
)
{
if
(
err
.
code
!=
=
0
)
{
console
.
log
(
"
updateConfiguration fail, err:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
"
updateConfiguration success.
"
);
}
})
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -94,17 +104,27 @@ updateConfiguration(config: Configuration): Promise\<void>
| ---------------------------------------- | ------- |
| Promise
\<
void> | 以Promise方式返回接口运行结果息,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
var
config
=
{
language
:
'
Zh-Hans
'
,
colorMode
:
COLOR_MODE_LIGHT
,
direction
:
DIRECTION_VERTICAL
,
screenDensity
:
SCREEN_DENSITY_SDPI
,
displayId
:
1
,
hasPointerDevice
:
true
,
}
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
const
config
=
{
language
:
'
Zh-Hans
'
,
// 简体中文
colorMode
:
COLOR_MODE_LIGHT
,
// 浅色模式
direction
:
DIRECTION_VERTICAL
,
// 垂直方向
screenDensity
:
SCREEN_DENSITY_SDPI
,
// 屏幕分辨率为"sdpi"
displayId
:
1
,
// 应用在Id为1的物理屏上显示
hasPointerDevice
:
true
,
// 指针类型设备已连接
};
try
{
abilityManager
.
updateConfiguration
(
config
).
then
(()
=>
{
...
...
@@ -113,8 +133,8 @@ try {
console
.
log
(
'
updateConfiguration fail, err:
'
+
JSON
.
stringify
(
err
));
})
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -134,20 +154,30 @@ getAbilityRunningInfos(callback: AsyncCallback\<Array\<AbilityRunningInfo>>): vo
| --------- | ---------------------------------------- | ---- | -------------- |
| callback | AsyncCallback
\<
Array
\<
[
AbilityRunningInfo
](
js-apis-inner-application-abilityRunningInfo.md
)
>> | 是 | 以回调方式返回接口运行结果及运行中的ability信息,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
try
{
abilityManager
.
getAbilityRunningInfos
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
abilityManager
.
getAbilityRunningInfos
((
err
,
data
)
=>
{
if
(
err
.
code
!=
=
0
)
{
console
.
log
(
"
getAbilityRunningInfos fail, error:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
"
getAbilityRunningInfos success, data:
"
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -167,9 +197,19 @@ getAbilityRunningInfos(): Promise\<Array\<AbilityRunningInfo>>
| ---------------------------------------- | ------- |
| Promise
\<
Array
\<
[
AbilityRunningInfo
](
js-apis-inner-application-abilityRunningInfo.md
)
>> | 以Promise方式返回接口运行结果及运行中的ability信息,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
try
{
abilityManager
.
getAbilityRunningInfos
().
then
((
data
)
=>
{
console
.
log
(
"
getAbilityRunningInfos success, data:
"
+
JSON
.
stringify
(
data
))
...
...
@@ -177,8 +217,8 @@ try {
console
.
log
(
"
getAbilityRunningInfos fail, err:
"
+
JSON
.
stringify
(
err
));
});
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -196,25 +236,35 @@ getExtensionRunningInfos(upperLimit: number, callback: AsyncCallback\<Array\<Ext
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ---------------------------------------- | ---- | -------------- |
| upperLimit | number | 是 | 获取消息数量的最大限制。 |
| upperLimit | number | 是 | 获取消息数量的最大限制
,最大为2
<sup>
31
</sup>
-1
。 |
| callback | AsyncCallback
\<
Array
\<
[
ExtensionRunningInfo
](
js-apis-inner-application-extensionRunningInfo.md
)
>> | 是 | 以回调方式返回接口运行结果及运行中的extension信息,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
var
upperLimit
=
0
;
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
let
upperLimit
=
10
;
try
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
,
(
err
,
data
)
=>
{
if
(
err
.
code
!=
=
0
)
{
console
.
log
(
"
getExtensionRunningInfos fail, err:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
"
getExtensionRunningInfos success, data:
"
+
JSON
.
stringify
(
data
));
}
});
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -232,7 +282,7 @@ getExtensionRunningInfos(upperLimit: number): Promise\<Array\<ExtensionRunningIn
| 参数名 | 类型 | 必填 | 说明 |
| --------- | ---------------------------------------- | ---- | -------------- |
| upperLimit | number | 是 | 获取消息数量的最大限制。 |
| upperLimit | number | 是 | 获取消息数量的最大限制
,最大为2
<sup>
31
</sup>
-1
。 |
**返回值:**
...
...
@@ -240,10 +290,20 @@ getExtensionRunningInfos(upperLimit: number): Promise\<Array\<ExtensionRunningIn
| ---------------------------------------- | ------- |
| Promise
\<
Array
\<
[
ExtensionRunningInfo
](
js-apis-inner-application-extensionRunningInfo.md
)
>> | 以Promise方式返回接口运行结果及运行中的extension信息,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
var
upperLimit
=
0
;
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
let
upperLimit
=
10
;
try
{
abilityManager
.
getExtensionRunningInfos
(
upperLimit
).
then
((
data
)
=>
{
...
...
@@ -252,8 +312,8 @@ try {
console
.
log
(
"
getExtensionRunningInfos fail, err:
"
+
JSON
.
stringify
(
err
));
})
}
catch
(
paramError
)
{
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
console
.
log
(
'
error.code:
'
+
JSON
.
stringify
(
paramError
.
code
)
+
'
error.message:
'
+
JSON
.
stringify
(
paramError
.
message
));
}
```
...
...
@@ -271,11 +331,21 @@ getTopAbility(callback: AsyncCallback\<ElementName>): void;
| --------- | ---------------------------------------- | ---- | -------------- |
| callback | AsyncCallback
\<
[
ElementName
](
js-apis-bundleManager-elementName.md
)
> | 是 | 以回调方式返回接口运行结果及应用名,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
abilityManager
.
getTopAbility
((
err
,
data
)
=>
{
if
(
err
.
code
!=
0
)
{
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
abilityManager
.
getTopAbility
((
err
,
data
)
=>
{
if
(
err
.
code
!==
0
)
{
console
.
log
(
"
getTopAbility fail, err:
"
+
JSON
.
stringify
(
err
));
}
else
{
console
.
log
(
"
getTopAbility success, data:
"
+
JSON
.
stringify
(
data
));
...
...
@@ -297,9 +367,19 @@ getTopAbility(): Promise\<ElementName>;
| ---------------------------------------- | ------- |
| Promise
\<
[
ElementName
](
js-apis-bundleManager-elementName.md
)
>| 以Promise方式返回接口运行结果及应用名,可进行错误处理或其他自定义处理。 |
**错误码**
:
| 错误码ID | 错误信息 |
| ------- | -------- |
| 16000050 | Internal error. |
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例**
:
```
ts
import
abilityManager
from
'
@ohos.app.ability.abilityManager
'
;
abilityManager
.
getTopAbility
().
then
((
data
)
=>
{
console
.
log
(
"
getTopAbility success, data:
"
+
JSON
.
stringify
(
data
));
}).
catch
((
err
)
=>
{
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-abilityStage.md
浏览文件 @
6b5cc367
...
...
@@ -26,6 +26,8 @@ onCreate(): void
**示例:**
```
ts
import
AbilityStage
from
'
@ohos.app.ability.AbilityStage
'
;
class
MyAbilityStage
extends
AbilityStage
{
onCreate
()
{
console
.
log
(
"
MyAbilityStage.onCreate is called
"
);
...
...
@@ -57,6 +59,8 @@ onAcceptWant(want: Want): string;
**示例:**
```
ts
import
AbilityStage
from
'
@ohos.app.ability.AbilityStage
'
;
class
MyAbilityStage
extends
AbilityStage
{
onAcceptWant
(
want
)
{
console
.
log
(
"
MyAbilityStage.onAcceptWant called
"
);
...
...
@@ -83,6 +87,8 @@ onConfigurationUpdate(newConfig: Configuration): void;
**示例:**
```
ts
import
AbilityStage
from
'
@ohos.app.ability.AbilityStage
'
;
class
MyAbilityStage
extends
AbilityStage
{
onConfigurationUpdate
(
config
)
{
console
.
log
(
'
onConfigurationUpdate, language:
'
+
config
.
language
);
...
...
@@ -107,6 +113,8 @@ onMemoryLevel(level: AbilityConstant.MemoryLevel): void;
**示例:**
```
ts
import
AbilityStage
from
'
@ohos.app.ability.AbilityStage
'
;
class
MyAbilityStage
extends
AbilityStage
{
onMemoryLevel
(
level
)
{
console
.
log
(
'
onMemoryLevel, level:
'
+
JSON
.
stringify
(
level
));
...
...
zh-cn/application-dev/reference/apis/js-apis-app-ability-appManager.md
浏览文件 @
6b5cc367
此差异已折叠。
点击以展开。
zh-cn/application-dev/reference/apis/js-apis-app-ability-appRecovery.md
浏览文件 @
6b5cc367
...
...
@@ -8,7 +8,7 @@ appRecovery模块提供了应用在故障状态下的恢复能力。
## 导入模块
```
ts
import
appRecovery
from
'
@ohos.app.ability.appRecovery
'
import
appRecovery
from
'
@ohos.app.ability.appRecovery
'
;
```
...
...
@@ -67,10 +67,17 @@ enableAppRecovery(restart?: [RestartFlag](#apprecoveryrestartflag), saveOccasion
**示例:**
```
ts
import
appRecovery
from
'
@ohos.app.ability.appRecovery
'
;
import
AbilityStage
from
'
@ohos.app.ability.AbilityStage
'
;
export
default
class
MyAbilityStage
extends
AbilityStage
{
import
UIAbility
from
'
@ohos.app.ability.UIAbility
'
;
export
default
class
MyAbility
extends
UIAbility
{
onCreate
()
{
appRecovery
.
enableAppRecovery
(
RestartFlag
::
ALWAYS_RESTART
,
SaveOccasionFlag
::
SAVE_WHEN_ERROR
,
SaveModeFlag
::
SAVE_WITH_FILE
);
appRecovery
.
enableAppRecovery
(
appRecovery
.
RestartFlag
::
ALWAYS_RESTART
,
appRecovery
.
SaveOccasionFlag
::
SAVE_WHEN_ERROR
,
appRecovery
.
SaveModeFlag
::
SAVE_WITH_FILE
);
}
}
```
...
...
@@ -87,12 +94,20 @@ restartApp(): void;
**示例:**
```
ts
import
appRecovery
from
'
@ohos.app.ability.appRecovery
'
;
import
errorManager
from
'
@ohos.app.ability.errorManager
'
;
var
observer
=
{
let
observer
=
{
onUnhandledException
(
errorMsg
)
{
console
.
log
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
)
appRecovery
.
restartApp
();
}
};
try
{
errorManager
.
on
(
"
error
"
,
observer
);
}
catch
(
paramError
)
{
console
.
log
(
"
error:
"
+
paramError
.
code
+
"
,
"
+
paramError
.
message
);
}
```
...
...
@@ -113,11 +128,19 @@ saveAppState(): boolean;
**示例:**
```
ts
import
appRecovery
from
'
@ohos.app.ability.appRecovery
'
;
import
errorManager
from
'
@ohos.app.ability.errorManager
'
;
var
observer
=
{
let
observer
=
{
onUnhandledException
(
errorMsg
)
{
console
.
log
(
'
onUnhandledException, errorMsg:
'
,
errorMsg
)
appRecovery
.
saveAppState
();
}
};
try
{
errorManager
.
on
(
"
error
"
,
observer
);
}
catch
(
paramError
)
{
console
.
log
(
"
error:
"
+
paramError
.
code
+
"
,
"
+
paramError
.
message
);
}
```
zh-cn/application-dev/reference/apis/js-apis-app-ability-uiAbility.md
浏览文件 @
6b5cc367
...
...
@@ -332,7 +332,8 @@ call(method: string, data: rpc.Sequenceable): Promise<void>;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -412,7 +413,8 @@ callWithResult(method: string, data: rpc.Sequenceable): Promise<rpc.MessagePa
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -573,7 +575,8 @@ release(): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -628,7 +631,8 @@ on(method: string, callback: CalleeCallback): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -693,7 +697,8 @@ off(method: string): void;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
zh-cn/application-dev/reference/apis/js-apis-inner-application-context.md
浏览文件 @
6b5cc367
...
...
@@ -52,7 +52,8 @@ createBundleContext(bundleName: string): Context;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -91,7 +92,8 @@ createModuleContext(moduleName: string): Context;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
@@ -129,7 +131,8 @@ createModuleContext(bundleName: string, moduleName: string): Context;
| 错误码ID | 错误信息 |
| ------- | -------------------------------- |
| 401 | If the input parameter is not valid parameter. |
其他ID见
[
元能力子系统错误码
](
../errorcodes/errorcode-ability.md
)
以上错误码详细介绍请参考
[
errcode-ability
](
../errorcodes/errorcode-ability.md
)
。
**示例:**
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录