From 9718e9ee7b6547c8ed4bba81bf04ea4f799bab9f Mon Sep 17 00:00:00 2001 From: VictoriaGuo Date: Mon, 9 May 2022 10:44:08 +0800 Subject: [PATCH] update direction/locale/screenDensity/deviceType instruction Signed-off-by: VictoriaGuo --- .../apis/js-apis-resource-manager.md | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md index 4d21c43229..547f7dd213 100644 --- a/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md +++ b/zh-cn/application-dev/reference/apis/js-apis-resource-manager.md @@ -1,5 +1,7 @@ # 资源管理 +资源管理模块,根据当前configuration(语言,区域,横竖屏,mccmnc)和device capability(设备类型,分辨率)提供获取应用资源信息读取接口。 + > ![icon-note.gif](public_sys-resources/icon-note.gif) **说明:** > 本模块首批接口从API version 6开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 @@ -175,6 +177,16 @@ getResourceManager(bundleName: string): Promise<ResourceManager> | direction | [Direction](#direction) | 是 | 否 | 当前设备屏幕方向 | | locale | string | 是 | 否 | 当前系统语言 | +**示例:** + + ``` +resourceManager.getResourceManager((error, mgr) => { + mgr.getConfiguration((error, value) => { + console.log(value.direction); + console.log(value.locale); + }); + }); + ``` ## DeviceCapability @@ -188,6 +200,16 @@ getResourceManager(bundleName: string): Promise<ResourceManager> | screenDensity | [ScreenDensity](#screendensity) | 是 | 否 | 当前设备屏幕密度 | | deviceType | [DeviceType](#devicetype) | 是 | 否 | 当前设备类型 | +**示例:** + + ``` +resourceManager.getResourceManager((error, mgr) => { + mgr.getDeviceCapability((error, value) => { + console.log(value.screenDensity); + console.log(value.deviceType); + }); + }); + ``` ## RawFileDescriptor8+ -- GitLab