Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
3f87ec2a
D
Docs
项目概览
OpenHarmony
/
Docs
接近 2 年 前同步成功
通知
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看板
未验证
提交
3f87ec2a
编写于
8月 31, 2023
作者:
O
openharmony_ci
提交者:
Gitee
8月 31, 2023
浏览文件
操作
浏览文件
下载
差异文件
!23520 【ArkTs整改】批量修改场景---无法自动推导出的类型;没有指定类型的初始化,catch 明确错误码类型
Merge pull request !23520 from junyi233/gaojing
上级
128a5f1d
ac2e654b
变更
6
隐藏空白更改
内联
并排
Showing
6 changed file
with
70 addition
and
48 deletion
+70
-48
zh-cn/application-dev/quick-start/arkts-watch.md
zh-cn/application-dev/quick-start/arkts-watch.md
+2
-2
zh-cn/application-dev/quick-start/atomicService-aging.md
zh-cn/application-dev/quick-start/atomicService-aging.md
+5
-3
zh-cn/application-dev/quick-start/atomicService.md
zh-cn/application-dev/quick-start/atomicService.md
+2
-1
zh-cn/application-dev/quick-start/cross-app-hsp.md
zh-cn/application-dev/quick-start/cross-app-hsp.md
+2
-1
zh-cn/application-dev/quick-start/in-app-hsp.md
zh-cn/application-dev/quick-start/in-app-hsp.md
+5
-3
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
...n/application-dev/reference/apis/js-apis-bundleManager.md
+54
-38
未找到文件。
zh-cn/application-dev/quick-start/arkts-watch.md
浏览文件 @
3f87ec2a
...
...
@@ -136,10 +136,10 @@ struct BasketViewer {
build
()
{
Column
()
{
ForEach
(
this
.
shopBasket
,
(
item
)
=>
{
(
item
:
PurchaseItem
)
=>
{
Text
(
`Price:
${
item
.
price
.
toFixed
(
2
)}
€`
)
},
item
=>
item
.
id
.
toString
()
(
item
:
PurchaseItem
)
=>
item
.
id
.
toString
()
)
Text
(
`Total:
${
this
.
totalPurchase
.
toFixed
(
2
)}
€`
)
}
...
...
zh-cn/application-dev/quick-start/atomicService-aging.md
浏览文件 @
3f87ec2a
...
...
@@ -16,8 +16,9 @@
```
ts
import
installer
from
'
@ohos.bundle.installer
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
let
bundleName
=
'
com.ohos.demo
'
;
let
installParam
=
{
let
installParam
:
installer
.
InstallParam
=
{
userId
:
100
};
...
...
@@ -30,11 +31,12 @@ try {
console
.
info
(
'
uninstall successfully.
'
);
}
});
}).
catch
(
error
=>
{
}).
catch
(
(
error
:
BusinessError
)
=>
{
console
.
error
(
'
getBundleInstaller failed. Cause:
'
+
error
.
message
);
});
}
catch
(
error
)
{
console
.
error
(
'
getBundleInstaller failed. Cause:
'
+
error
.
message
);
let
message
=
(
error
as
BusinessError
).
message
;
console
.
error
(
'
getBundleInstaller failed. Cause:
'
+
message
);
}
```
...
...
zh-cn/application-dev/quick-start/atomicService.md
浏览文件 @
3f87ec2a
...
...
@@ -165,6 +165,7 @@ preloads列表配置的moduleName对应的[moduleType(模块类型)](../referenc
```
ts
import
router
from
'
@ohos.router
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
@
Entry
@
Component
...
...
@@ -196,7 +197,7 @@ struct Index {
url
:
'
@bundle:com.example.hmservice/library/ets/pages/menu
'
}).
then
(()
=>
{
console
.
log
(
"
push page success
"
);
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
error
(
`pushUrl failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
})
...
...
zh-cn/application-dev/quick-start/cross-app-hsp.md
浏览文件 @
3f87ec2a
...
...
@@ -82,7 +82,8 @@ export function foo2() {
import
native
from
"
libnative.so
"
export
function
nativeMulti
(
a
:
number
,
b
:
number
)
{
return
native
.
multi
(
a
,
b
);
let
result
:
number
=
native
.
multi
(
a
,
b
);
return
result
;
}
```
...
...
zh-cn/application-dev/quick-start/in-app-hsp.md
浏览文件 @
3f87ec2a
...
...
@@ -23,7 +23,7 @@ library
```
ts
// library/src/main/ets/utils/test.ts
export
class
Log
{
static
info
(
msg
)
{
static
info
(
msg
:
string
)
{
console
.
info
(
msg
);
}
}
...
...
@@ -119,7 +119,8 @@ export { ResManager } from './ResManager'
import
native
from
"
libnative.so
"
export
function
nativeMulti
(
a
:
number
,
b
:
number
)
{
return
native
.
multi
(
a
,
b
);
let
result
:
number
=
native
.
multi
(
a
,
b
);
return
result
;
}
```
...
...
@@ -194,6 +195,7 @@ struct Index {
若开发者想在entry模块中,添加一个按钮跳转至library模块中的menu页面(路径为:
`library/src/main/ets/pages/menu.ets`
),那么可以在使用方的代码(entry模块下的Index.ets,路径为:
`entry/src/main/ets/MainAbility/Index.ets`
)里这样使用:
```
ts
import
router
from
'
@ohos.router
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
@
Entry
@
Component
...
...
@@ -225,7 +227,7 @@ struct Index {
url
:
'
@bundle:com.example.hmservice/library/ets/pages/menu
'
}).
then
(()
=>
{
console
.
log
(
"
push page success
"
);
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
console
.
error
(
`pushUrl failed, code is
${
err
.
code
}
, message is
${
err
.
message
}
`
);
})
})
...
...
zh-cn/application-dev/reference/apis/js-apis-bundleManager.md
浏览文件 @
3f87ec2a
...
...
@@ -1020,9 +1020,10 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId: numbe
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1078,8 +1079,9 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), callback: Asy
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1142,9 +1144,10 @@ queryAbilityInfo(want: Want, abilityFlags: [number](#abilityflag), userId?: numb
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1165,8 +1168,9 @@ try {
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1227,9 +1231,10 @@ queryAbilityInfoSync(want: Want, abilityFlags: [number](#abilityflag), userId?:
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1248,8 +1253,9 @@ try {
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1302,10 +1308,11 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1361,9 +1368,10 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1426,11 +1434,12 @@ queryExtensionAbilityInfo(want: Want, extensionAbilityType: [ExtensionAbilityTyp
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1451,9 +1460,10 @@ try {
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1514,11 +1524,12 @@ queryExtensionAbilityInfoSync(want: Want, extensionAbilityType: [ExtensionAbilit
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -1536,9 +1547,10 @@ try {
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
extensionAbilityType
=
bundleManager
.
ExtensionAbilityType
.
FORM
;
let
extensionFlags
=
bundleManager
.
ExtensionAbilityFlag
.
GET_EXTENSION_ABILITY_INFO_DEFAULT
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
...
...
@@ -2140,18 +2152,18 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
bundleManager
.
setAbilityEnabled
(
info
,
false
,
err
=>
{
if
(
err
)
{
...
...
@@ -2209,18 +2221,18 @@ setAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), isE
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
bundleManager
.
setAbilityEnabled
(
info
,
false
).
then
(()
=>
{
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabled successfully.
"
);
...
...
@@ -2270,26 +2282,27 @@ setAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md),
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
try
{
bundleManager
.
setAbilityEnabledSync
(
info
,
false
);
hilog
.
info
(
0x0000
,
"
testTag
"
,
"
setAbilityEnabledSync successfully.
"
);
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setAbilityEnabledSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
setAbilityEnabledSync failed: %{public}s
'
,
message
);
}
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
}
catch
(
err
)
{
...
...
@@ -2474,18 +2487,18 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md), call
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
bundleManager
.
isAbilityEnabled
(
info
,
(
err
,
data
)
=>
{
if
(
err
)
{
...
...
@@ -2540,25 +2553,25 @@ isAbilityEnabled(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)): Pro
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
bundleManager
.
isAbilityEnabled
(
info
).
then
((
data
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabled successfully. Data: %{public}s
'
,
JSON
.
stringify
(
data
));
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabled failed. Cause: %{public}s
'
,
err
.
message
);
});
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
}
catch
(
err
)
{
...
...
@@ -2604,26 +2617,27 @@ isAbilityEnabledSync(info: [AbilityInfo](js-apis-bundleManager-abilityInfo.md)):
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
abilityFlags
=
bundleManager
.
AbilityFlag
.
GET_ABILITY_INFO_DEFAULT
;
let
userId
=
100
;
let
want
=
{
let
want
:
Want
=
{
bundleName
:
"
com.example.myapplication
"
,
abilityName
:
"
EntryAbility
"
};
let
info
;
try
{
bundleManager
.
queryAbilityInfo
(
want
,
abilityFlags
,
userId
).
then
((
abilitiesInfo
)
=>
{
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo successfully. Data: %{public}s
'
,
JSON
.
stringify
(
abilitiesInfo
));
info
=
abilitiesInfo
[
0
];
let
info
=
abilitiesInfo
[
0
];
try
{
let
data
=
bundleManager
.
isAbilityEnabledSync
(
info
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabledSync successfully: %{public}s
'
,
JSON
.
stringify
(
data
));
}
catch
(
err
)
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabledSync failed: %{public}s
'
,
err
.
message
);
let
message
=
(
err
as
BusinessError
).
message
;
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
isAbilityEnabledSync failed: %{public}s
'
,
message
);
}
}).
catch
(
err
=>
{
}).
catch
(
(
err
:
BusinessError
)
=>
{
hilog
.
error
(
0x0000
,
'
testTag
'
,
'
queryAbilityInfo failed. Cause: %{public}s
'
,
err
.
message
);
});
}
catch
(
err
)
{
...
...
@@ -2833,11 +2847,12 @@ getLaunchWantForBundleSync(bundleName: string, userId?: number): Want;
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
try
{
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
,
userId
);
let
want
:
Want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
,
userId
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
}
catch
(
err
)
{
let
message
=
(
err
as
BusinessError
).
message
;
...
...
@@ -2849,11 +2864,12 @@ try {
import
bundleManager
from
'
@ohos.bundle.bundleManager
'
;
import
{
BusinessError
}
from
'
@ohos.base
'
;
import
hilog
from
'
@ohos.hilog
'
;
import
Want
from
'
@ohos.app.ability.Want
'
;
let
bundleName
=
'
com.example.myapplication
'
;
let
userId
=
100
;
try
{
let
want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
);
let
want
:
Want
=
bundleManager
.
getLaunchWantForBundleSync
(
bundleName
);
hilog
.
info
(
0x0000
,
'
testTag
'
,
'
getLaunchWantForBundleSync successfully. Data: %{public}s
'
,
JSON
.
stringify
(
want
));
}
catch
(
err
)
{
let
message
=
(
err
as
BusinessError
).
message
;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录