harmony 鸿蒙Bundle Management Subsystem Changelog
Bundle Management Subsystem Changelog
cl.bundlemanager.1 Field metadata in the ApplicationInfo struct Deprecated
The metadata field is deprecated since API version 10. You are advised to use metadataArray instead.
Change Impact
The metadata field in the ApplicationInfo struct is no longer maintained since API version 10.
Key API/Component Changes
The metadata field in the ApplicationInfo struct is deprecated since API version 10.
Adaptation Guide
Use the metadataArray field to replace the metadata field.
import bundleManager from '@ohos.bundle.bundleManager';
import { BusinessError } from '@ohos.base';
import hilog from '@ohos.hilog';
let bundleName = 'com.example.myapplication';
let appFlags = bundleManager.ApplicationFlag.GET_APPLICATION_INFO_WITH_METADATA;
let userId = 100;
try {
bundleManager.getApplicationInfo(bundleName, appFlags, userId, (err, data) => {
if (err) {
hilog.error(0x0000, 'testTag', 'getApplicationInfo failed: %{public}s', err.message);
} else {
hilog.info(0x0000, 'testTag', 'getApplicationInfo successfully: %{public}s', JSON.stringify(data));
hilog.info(0x0000, 'testTag', 'metadataArray is: %{public}s', JSON.stringify(data.metadataArray));
}
});
} catch (err) {
let message = (err as BusinessError).message;
hilog.error(0x0000, 'testTag', 'getApplicationInfo failed: %{public}s', message);
}
你可能感兴趣的鸿蒙文章
0
赞
- 所属分类: 后端技术
- 本文标签:
热门推荐
-
2、 - 优质文章
-
3、 gate.io
-
8、 golang
-
9、 openharmony
-
10、 Vue中input框自动聚焦