• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Resourcemanager
2
3
4## Overview
5
6Provides C APIs for obtaining resources.
7
8**Since**: 12
9
10
11## Summary
12
13
14### File
15
16| Name| Description|
17| -------- | -------- |
18| [ohresmgr.h](ohresmgr_8h.md) | Provides native APIs for obtaining resources.|
19| [resmgr_common.h](resmgr__common_8h.md) | Provides the enum types and structures for resource manager APIs.|
20
21
22### Structs
23
24| Name| Description|
25| -------- | -------- |
26| struct  [ResourceManager_Configuration](_resource_manager___configuration.md) | Enumerates device states.|
27
28
29### Types
30
31| Name| Description|
32| -------- | -------- |
33| typedef enum [ResourceManager_Direction](#resourcemanager_direction) [ResourceManager_Direction](#resourcemanager_direction) | Enumerates screen orientations.|
34| typedef enum [ResourceManager_ColorMode](#resourcemanager_colormode) [ResourceManager_ColorMode](#resourcemanager_colormode) | Enumerates color modes.|
35| typedef enum [ResourceManager_DeviceType](#resourcemanager_devicetype) [ResourceManager_DeviceType](#resourcemanager_devicetype) | Enumerates device types.|
36| typedef struct [ResourceManager_Configuration](_resource_manager___configuration.md) [ResourceManager_Configuration](#resourcemanager_configuration) | Enumerates device states.|
37
38
39### Enum
40
41| Name| Description|
42| -------- | -------- |
43| [ResourceManager_ErrorCode](#resourcemanager_errorcode) {<br>SUCCESS = 0, ERROR_CODE_INVALID_INPUT_PARAMETER = 401, ERROR_CODE_RES_ID_NOT_FOUND = 9001001, ERROR_CODE_RES_NOT_FOUND_BY_ID = 9001002,<br>ERROR_CODE_RES_NAME_NOT_FOUND = 9001003, ERROR_CODE_RES_NOT_FOUND_BY_NAME = 9001004, ERROR_CODE_RES_PATH_INVALID = 9001005, ERROR_CODE_RES_REF_TOO_MUCH = 9001006,<br>ERROR_CODE_RES_ID_FORMAT_ERROR = 9001007, ERROR_CODE_RES_NAME_FORMAT_ERROR = 9001008, ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED = 9001009, ERROR_CODE_OVERLAY_RES_PATH_INVALID = 9001010,<br>ERROR_CODE_OUT_OF_MEMORY = 9001100<br>} | Enumerates resource manager error codes.|
44| [ScreenDensity](#screendensity) {<br>SCREEN_SDPI = 120, SCREEN_MDPI = 160, SCREEN_LDPI = 240, SCREEN_XLDPI = 320,<br>SCREEN_XXLDPI = 480, SCREEN_XXXLDPI = 640<br>} | Enumerates screen density types.|
45| [ResourceManager_Direction](#resourcemanager_direction) { DIRECTION_VERTICAL = 0, DIRECTION_HORIZONTAL = 1 } | Enumerates screen orientations.|
46| [ResourceManager_ColorMode](#resourcemanager_colormode) { DARK = 0, LIGHT = 1 } | Enumerates color modes.|
47| [ResourceManager_DeviceType](#resourcemanager_devicetype) {<br>DEVICE_TYPE_PHONE = 0X00, DEVICE_TYPE_TABLET = 0x01, DEVICE_TYPE_CAR = 0x02, DEVICE_TYPE_PC = 0x03,<br>DEVICE_TYPE_TV = 0x04, DEVICE_TYPE_WEARABLE = 0x06, DEVICE_TYPE_2IN1 = 0x07<br>} | Enumerates device types.|
48
49
50### Callback
51
52| Name| Description|
53| -------- | -------- |
54| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64](#oh_resourcemanager_getmediabase64) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.|
55| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64Data](#oh_resourcemanager_getmediabase64data) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue, uint64_t \*resultLen, uint32_t density) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.|
56| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64ByName](#oh_resourcemanager_getmediabase64byname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.|
57| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaBase64DataByName](#oh_resourcemanager_getmediabase64databyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue, uint64_t \*resultLen, uint32_t density) | Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.|
58| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMedia](#oh_resourcemanager_getmedia) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | Obtains the content of the media resource with the specified screen density based on the specified resource ID.|
59| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaData](#oh_resourcemanager_getmediadata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density) | Obtains the content of the media resource with the specified screen density based on the specified resource ID.|
60| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaByName](#oh_resourcemanager_getmediabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density=0) | Obtains the content of the media resource with the specified screen density based on the specified resource name.|
61| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetMediaDataByName](#oh_resourcemanager_getmediadatabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint8_t \*\*resultValue, uint64_t \*resultLen, uint32_t density) | Obtains the content of the media resource with the specified screen density based on the specified resource name.|
62| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptor](#oh_resourcemanager_getdrawabledescriptor) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density=0, uint32_t type=0) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.|
63| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorData](#oh_resourcemanager_getdrawabledescriptordata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.|
64| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorByName](#oh_resourcemanager_getdrawabledescriptorbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density=0, uint32_t type=0) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.|
65| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetDrawableDescriptorDataByName](#oh_resourcemanager_getdrawabledescriptordatabyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, ArkUI_DrawableDescriptor \*\*drawableDescriptor, uint32_t density, uint32_t type) | Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.|
66| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbol](#oh_resourcemanager_getsymbol) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | Obtains a **symbol** resource based on the specified resource ID.|
67| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetSymbolByName](#oh_resourcemanager_getsymbolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | Obtains a **symbol** resource based on the specified resource name.|
68| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetLocales](#oh_resourcemanager_getlocales) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, char \*\*\*resultValue, uint32_t \*resultLen, bool includeSystem=false) | Obtains the language list.|
69| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetLocalesData](#oh_resourcemanager_getlocalesdata) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, char \*\*\*resultValue, uint32_t \*resultLen, bool includeSystem) | Obtains the language list.|
70| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetConfiguration](#oh_resourcemanager_getconfiguration) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, [ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | Obtains the device configuration.|
71| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseConfiguration](#oh_resourcemanager_releaseconfiguration) ([ResourceManager_Configuration](_resource_manager___configuration.md) \*configuration) | Releases the memory requested by using **OH_ResourceManager_GetConfiguration()**.|
72| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetString](#oh_resourcemanager_getstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*resultValue,...) | Obtains a **string** resource based on the specified resource ID.|
73| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringByName](#oh_resourcemanager_getstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*resultValue,...) | Obtains a **string** resource based on the specified resource name.|
74| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringArray](#oh_resourcemanager_getstringarray) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, char \*\*\*resultValue, uint32_t \*resultLen) | Obtains a string array based on the specified resource ID.|
75| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetStringArrayByName](#oh_resourcemanager_getstringarraybyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, char \*\*\*resultValue, uint32_t \*resultLen) | Obtains a string array based on the specified resource name.|
76| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_ReleaseStringArray](#oh_resourcemanager_releasestringarray) (char \*\*\*resValue, uint32_t len) | Releases the memory of the string array.|
77| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetPluralString](#oh_resourcemanager_getpluralstring) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t num, char \*\*resultValue) | Obtains singular and plural strings based on the specified resource ID.|
78| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetPluralStringByName](#oh_resourcemanager_getpluralstringbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t num, char \*\*resultValue) | Obtains singular and plural strings based on the specified resource name.|
79| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColor](#oh_resourcemanager_getcolor) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, uint32_t \*resultValue) | Obtains a color value based on the specified resource ID.|
80| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetColorByName](#oh_resourcemanager_getcolorbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, uint32_t \*resultValue) | Obtains a color value based on the specified resource ID.|
81| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetInt](#oh_resourcemanager_getint) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, int \*resultValue) | Obtains an int value based on the specified resource ID.|
82| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetIntByName](#oh_resourcemanager_getintbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, int \*resultValue) | Obtains an int value based on the specified resource name.|
83| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloat](#oh_resourcemanager_getfloat) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, float \*resultValue) | Obtains a float value based on the specified resource ID.|
84| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetFloatByName](#oh_resourcemanager_getfloatbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, float \*resultValue) | Obtains a float value based on the specified resource name.|
85| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBool](#oh_resourcemanager_getbool) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, uint32_t resId, bool \*resultValue) | Obtains a bool value based on the specified resource ID.|
86| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_GetBoolByName](#oh_resourcemanager_getboolbyname) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*resName, bool \*resultValue) | Obtains a bool value based on the specified resource name.|
87| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_AddResource](#oh_resourcemanager_addresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | Adds overlay resources when an application is running.|
88| [ResourceManager_ErrorCode](#resourcemanager_errorcode) [OH_ResourceManager_RemoveResource](#oh_resourcemanager_removeresource) (const [NativeResourceManager](rawfile.md#nativeresourcemanager) \*mgr, const char \*path) | Removes overlay resources when an application is running.|
89
90
91## Type Description
92
93
94### ResourceManager_ColorMode
95
96```
97typedef enum ResourceManager_ColorModeResourceManager_ColorMode
98```
99
100**Description**
101
102Enumerates color modes.
103
104**Since**: 12
105
106
107### ResourceManager_Configuration
108
109```
110typedef struct ResourceManager_ConfigurationResourceManager_Configuration
111```
112
113**Description**
114
115Enumerates device states.
116
117**Since**: 12
118
119
120### ResourceManager_DeviceType
121
122```
123typedef enum ResourceManager_DeviceTypeResourceManager_DeviceType
124```
125
126**Description**
127
128Enumerates device types.
129
130**Since**: 12
131
132
133### ResourceManager_Direction
134
135```
136typedef enum ResourceManager_DirectionResourceManager_Direction
137```
138
139**Description**
140
141Enumerates screen orientations.
142
143**Since**: 12
144
145
146## Enum Description
147
148
149### ResourceManager_ColorMode
150
151```
152enum ResourceManager_ColorMode
153```
154
155**Description**
156
157Enumerates color modes.
158
159**Since**: 12
160
161| Value| Description|
162| -------- | -------- |
163| DARK | Dark mode.|
164| LIGHT | Light mode.|
165
166
167### ResourceManager_DeviceType
168
169```
170enum ResourceManager_DeviceType
171```
172
173**Description**
174
175Enumerates device types.
176
177**Since**: 12
178
179| Value| Description|
180| -------- | -------- |
181| DEVICE_TYPE_PHONE | Phone|
182| DEVICE_TYPE_TABLET | Tablet|
183| DEVICE_TYPE_CAR | Automobile|
184| DEVICE_TYPE_PC | Computer|
185| DEVICE_TYPE_TV | TV|
186| DEVICE_TYPE_WEARABLE | Wearable|
187| DEVICE_TYPE_2IN1 | 2-in-1 device|
188
189
190### ResourceManager_Direction
191
192```
193enum ResourceManager_Direction
194```
195
196**Description**
197
198Enumerates screen orientations.
199
200**Since**: 12
201
202| Value| Description|
203| -------- | -------- |
204| DIRECTION_VERTICAL | Vertical direction.|
205| DIRECTION_HORIZONTAL | Horizontal direction.|
206
207
208### ResourceManager_ErrorCode
209
210```
211enum ResourceManager_ErrorCode
212```
213
214**Description**
215
216Enumerates resource manager error codes.
217
218**Since**: 12
219
220| Value| Description|
221| -------- | -------- |
222| SUCCESS | Success.|
223| ERROR_CODE_INVALID_INPUT_PARAMETER | Invalid input parameter.|
224| ERROR_CODE_RES_ID_NOT_FOUND | Invalid resource ID.|
225| ERROR_CODE_RES_NOT_FOUND_BY_ID | Invalid resource name.|
226| ERROR_CODE_RES_NAME_NOT_FOUND | No matching resource found based on the resource ID.|
227| ERROR_CODE_RES_NOT_FOUND_BY_NAME | No matching resource found based on the resource name.|
228| ERROR_CODE_RES_PATH_INVALID | Invalid relative path.|
229| ERROR_CODE_RES_REF_TOO_MUCH | Resource referenced cyclically.|
230| ERROR_CODE_RES_ID_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource ID.|
231| ERROR_CODE_RES_NAME_FORMAT_ERROR | Failed to format the resource obtained based on the specified resource name.|
232| ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED | Failed to access system resources.|
233| ERROR_CODE_OVERLAY_RES_PATH_INVALID | Invalid overlay path.|
234| ERROR_CODE_OUT_OF_MEMORY | Memory overflow.|
235
236
237### ScreenDensity
238
239```
240enum ScreenDensity
241```
242
243**Description**
244
245Enumerates screen density types.
246
247**Since**: 12
248
249| Value| Description|
250| -------- | -------- |
251| SCREEN_SDPI | Screen density with small-scale dots per inch (SDPI).|
252| SCREEN_MDPI | Screen density with medium-scale dots per inch (MDPI).|
253| SCREEN_LDPI | Screen density with large-scale dots per inch (LDPI).|
254| SCREEN_XLDPI | Screen density with extra-large-scale dots per inch (XLDPI).|
255| SCREEN_XXLDPI | Screen density with extra-extra-large-scale dots per inch (XXLDPI).|
256| SCREEN_XXXLDPI | Screen density with extra-extra-extra-large-scale dots per inch (XXXLDPI).|
257
258
259## Function Description
260
261
262### OH_ResourceManager_AddResource()
263
264```
265ResourceManager_ErrorCode OH_ResourceManager_AddResource (const NativeResourceManager * mgr, const char * path )
266```
267
268**Description**
269
270Adds overlay resources when an application is running.
271
272**Since**: 12
273
274**Parameters**
275
276| Name| Description|
277| -------- | -------- |
278| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
279| path | Resource path.|
280
281**Returns**
282
283SUCCESS = 0: Operation succeeded.
284
285ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
286
287ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - The resource path is invalid.
288
289
290### OH_ResourceManager_GetBool()
291
292```
293ResourceManager_ErrorCode OH_ResourceManager_GetBool (const NativeResourceManager * mgr, uint32_t resId, bool * resultValue )
294```
295
296**Description**
297
298Obtains a bool value based on the specified resource ID.
299
300**Since**: 12
301
302**Parameters**
303
304| Name| Description|
305| -------- | -------- |
306| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
307| resId | Resource ID.|
308| resultValue | Result of writing **resultValue**.|
309
310**Returns**
311
312SUCCESS = 0: Operation succeeded.
313
314ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
315
316ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
317
318ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
319
320ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
321
322
323### OH_ResourceManager_GetBoolByName()
324
325```
326ResourceManager_ErrorCode OH_ResourceManager_GetBoolByName (const NativeResourceManager * mgr, const char * resName, bool * resultValue )
327```
328
329**Description**
330
331Obtains a bool value based on the specified resource name.
332
333**Since**: 12
334
335**Parameters**
336
337| Name| Description|
338| -------- | -------- |
339| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
340| resName | Resource name.|
341| resultValue | Result of writing **resultValue**.|
342
343**Returns**
344
345SUCCESS = 0: Operation succeeded.
346
347ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
348
349ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
350
351ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
352
353ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
354
355
356### OH_ResourceManager_GetColor()
357
358```
359ResourceManager_ErrorCode OH_ResourceManager_GetColor (const NativeResourceManager * mgr, uint32_t resId, uint32_t * resultValue )
360```
361
362**Description**
363
364Obtains a color value based on the specified resource ID.
365
366**Since**: 12
367
368**Parameters**
369
370| Name| Description|
371| -------- | -------- |
372| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
373| resId | Resource ID.|
374| resultValue | Result of writing **resultValue**.|
375
376**Returns**
377
378SUCCESS = 0: Operation succeeded.
379
380ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
381
382ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
383
384ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
385
386ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
387
388
389### OH_ResourceManager_GetColorByName()
390
391```
392ResourceManager_ErrorCode OH_ResourceManager_GetColorByName (const NativeResourceManager * mgr, const char * resName, uint32_t * resultValue )
393```
394
395**Description**
396
397Obtains a color value based on the specified resource ID.
398
399**Since**: 12
400
401**Parameters**
402
403| Name| Description|
404| -------- | -------- |
405| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
406| resName | Resource name.|
407| resultValue | Result of writing **resultValue**.|
408
409**Returns**
410
411SUCCESS = 0: Operation succeeded.
412
413ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
414
415ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
416
417ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
418
419ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
420
421
422### OH_ResourceManager_GetConfiguration()
423
424```
425ResourceManager_ErrorCode OH_ResourceManager_GetConfiguration (const NativeResourceManager * mgr, ResourceManager_Configuration * configuration )
426```
427
428**Description**
429
430Obtains the device configuration.
431
432After using this API, you need to call **OH_ResourceManager_ReleaseConfiguration()** to release the memory. If the **ResourceManager_Configuration** object is created by using malloc, call **free()** to release the object.
433
434**Since**: 12
435
436**Parameters**
437
438| Name| Description|
439| -------- | -------- |
440| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
441| configuration | Device configuration.|
442
443**Returns**
444
445SUCCESS = 0: Operation succeeded.
446
447ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
448
449ERROR_CODE_SYSTEM_RES_MANAGER_GET_FAILED 9001009 - Failed to access system resources.
450
451ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
452
453
454### OH_ResourceManager_GetDrawableDescriptor()
455
456```
457ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptor (const NativeResourceManager * mgr, uint32_t resId, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
458```
459
460**Description**
461
462Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.
463
464**Since**: 12
465
466**Parameters**
467
468| Name| Description|
469| -------- | -------- |
470| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
471| resId | Resource ID.|
472| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
473| type | Icon type. The value **0** indicates an application icon, and the value **1** indicates a theme icon.|
474| drawableDescriptor | Result of writing **drawableDescriptor**.|
475
476**Returns**
477
478SUCCESS = 0: Operation succeeded.
479
480ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
481
482ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
483
484ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
485
486
487### OH_ResourceManager_GetDrawableDescriptorByName()
488
489```
490ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorByName (const NativeResourceManager * mgr, const char * resName, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density = 0, uint32_t type = 0 )
491```
492
493Description
494
495Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.
496
497**Since**: 12
498
499**Parameters**
500
501| Name| Description|
502| -------- | -------- |
503| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
504| resName | Resource name.|
505| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
506| type | Icon type. This parameter is optional. The value **0** indicates an application icon, the value **1** indicates a theme icon, and the value **2** indicates a dynamic icon.|
507| drawableDescriptor | Result of writing **drawableDescriptor**.|
508
509**Returns**
510
511SUCCESS = 0: Operation succeeded.
512
513ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
514
515ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
516
517ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
518
519
520### OH_ResourceManager_GetDrawableDescriptorData()
521
522```
523ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorData (const NativeResourceManager * mgr, uint32_t resId, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density, uint32_t type )
524```
525
526**Description**
527
528Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource ID.
529
530**Since**: 12
531
532**Parameters**
533
534| Name| Description|
535| -------- | -------- |
536| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
537| resId | Resource ID.|
538| drawableDescriptor | Result of writing **drawableDescriptor**.|
539| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
540| type | Icon type. This parameter is optional. The value **0** indicates an application icon, and the value **1** indicates a theme icon. If this parameter is not required, set it to **0**.|
541
542**Returns**
543
544SUCCESS = 0: Operation succeeded.
545
546ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
547
548ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
549
550ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
551
552
553### OH_ResourceManager_GetDrawableDescriptorDataByName()
554
555```
556ResourceManager_ErrorCode OH_ResourceManager_GetDrawableDescriptorDataByName (const NativeResourceManager * mgr, const char * resName, ArkUI_DrawableDescriptor ** drawableDescriptor, uint32_t density, uint32_t type )
557```
558
559**Description**
560
561Obtains the **DrawableDescriptor** object of the icon resource with the specified screen density based on the specified resource name.
562
563**Since**: 12
564
565**Parameters**
566
567| Name| Description|
568| -------- | -------- |
569| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
570| resName | Resource name.|
571| drawableDescriptor | Result of writing **drawableDescriptor**.|
572| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
573| type | Icon type. This parameter is optional. The value **0** indicates an application icon, and the value **1** indicates a theme icon. If this parameter is not required, set it to **0**.|
574
575**Returns**
576
577SUCCESS = 0: Operation succeeded.
578
579ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
580
581ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
582
583ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
584
585
586### OH_ResourceManager_GetFloat()
587
588```
589ResourceManager_ErrorCode OH_ResourceManager_GetFloat (const NativeResourceManager * mgr, uint32_t resId, float * resultValue )
590```
591
592**Description**
593
594Obtains a float value based on the specified resource ID.
595
596**Since**: 12
597
598**Parameters**
599
600| Name| Description|
601| -------- | -------- |
602| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
603| resId | Resource ID.|
604| resultValue | Result of writing **resultValue**.|
605
606**Returns**
607
608SUCCESS = 0: Operation succeeded.
609
610ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
611
612ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
613
614ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
615
616ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
617
618
619### OH_ResourceManager_GetFloatByName()
620
621```
622ResourceManager_ErrorCode OH_ResourceManager_GetFloatByName (const NativeResourceManager * mgr, const char * resName, float * resultValue )
623```
624
625**Description**
626
627Obtains a float value based on the specified resource name.
628
629**Since**: 12
630
631**Parameters**
632
633| Name| Description|
634| -------- | -------- |
635| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
636| resName | Resource name.|
637| resultValue | Result of writing **resultValue**.|
638
639**Returns**
640
641SUCCESS = 0: Operation succeeded.
642
643ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
644
645ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
646
647ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
648
649ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
650
651
652### OH_ResourceManager_GetInt()
653
654```
655ResourceManager_ErrorCode OH_ResourceManager_GetInt (const NativeResourceManager * mgr, uint32_t resId, int * resultValue )
656```
657
658**Description**
659
660Obtains an int value based on the specified resource ID.
661
662**Since**: 12
663
664**Parameters**
665
666| Name| Description|
667| -------- | -------- |
668| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
669| resId | Resource ID.|
670| resultValue | Result of writing **resultValue**.|
671
672**Returns**
673
674SUCCESS = 0: Operation succeeded.
675
676ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
677
678ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
679
680ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
681
682ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
683
684
685### OH_ResourceManager_GetIntByName()
686
687```
688ResourceManager_ErrorCode OH_ResourceManager_GetIntByName (const NativeResourceManager * mgr, const char * resName, int * resultValue )
689```
690
691**Description**
692
693Obtains an int value based on the specified resource name.
694
695**Since**: 12
696
697**Parameters**
698
699| Name| Description|
700| -------- | -------- |
701| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
702| resName | Resource name.|
703| resultValue | Result of writing **resultValue**.|
704
705**Returns**
706
707SUCCESS = 0: Operation succeeded.
708
709ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
710
711ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
712
713ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
714
715ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
716
717
718### OH_ResourceManager_GetLocales()
719
720```
721ResourceManager_ErrorCode OH_ResourceManager_GetLocales (const NativeResourceManager * mgr, char *** resultValue, uint32_t * resultLen, bool includeSystem = false )
722```
723
724**Description**
725
726Obtains the language list.
727
728After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of **localinfo**.
729
730**Since**: 12
731
732**Parameters**
733
734| Name| Description|
735| -------- | -------- |
736| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
737| resultValue | Result of writing **resultValue**.|
738| resultLen | Length of locales written to **resultLen**.|
739| includeSystem | Whether system resources are included. The default value is **false**. This parameter does not take effect if only system resources are involved when you query the list of locales.|
740
741**Returns**
742
743SUCCESS = 0: Operation succeeded.
744
745ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
746
747ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
748
749
750### OH_ResourceManager_GetLocalesData()
751
752```
753ResourceManager_ErrorCode OH_ResourceManager_GetLocalesData (const NativeResourceManager * mgr, char *** resultValue, uint32_t * resultLen, bool includeSystem )
754```
755
756**Description**
757
758Obtains the language list.
759
760After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of **localinfo**.
761
762**Since**: 12
763
764**Parameters**
765
766| Name| Description|
767| -------- | -------- |
768| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
769| resultValue | Result of writing **resultValue**.|
770| resultLen | Length of locales written to **resultLen**.|
771| includeSystem | Whether system resources are included. If this parameter is not required, set it to **false**.|
772
773**Returns**
774
775SUCCESS = 0: Operation succeeded.
776
777ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
778
779ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
780
781
782### OH_ResourceManager_GetMedia()
783
784```
785ResourceManager_ErrorCode OH_ResourceManager_GetMedia (const NativeResourceManager * mgr, uint32_t resId, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
786```
787
788Description
789
790Obtains the content of the media resource with the specified screen density based on the specified resource ID.
791
792**Since**: 12
793
794**Parameters**
795
796| Name| Description|
797| -------- | -------- |
798| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
799| resId | Resource ID.|
800| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
801| resultValue | Result of writing **resultValue**.|
802| resultLen | Length of media written to **resultLen**.|
803
804**Returns**
805
806SUCCESS = 0: Operation succeeded.
807
808ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
809
810ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
811
812ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
813
814ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
815
816
817### OH_ResourceManager_GetMediaBase64()
818
819```
820ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64 (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
821```
822
823Description
824
825Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.
826
827**Since**: 12
828
829**Parameters**
830
831| Name| Description|
832| -------- | -------- |
833| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
834| resId | Resource ID.|
835| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
836| resultValue | Result of writing **resultValue**.|
837| resultLen | Length of media written to **resultLen**.|
838
839**Returns**
840
841SUCCESS = 0: Operation succeeded.
842
843ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
844
845ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
846
847ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
848
849ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
850
851
852### OH_ResourceManager_GetMediaBase64ByName()
853
854```
855ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64ByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
856```
857
858Description
859
860Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.
861
862**Since**: 12
863
864**Parameters**
865
866| Name| Description|
867| -------- | -------- |
868| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
869| resName | Resource name.|
870| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
871| resultValue | Result of writing **resultValue**.|
872| resultLen | Length of media written to **resultLen**.|
873
874**Returns**
875
876SUCCESS = 0: Operation succeeded.
877
878ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
879
880ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
881
882ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
883
884ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
885
886
887### OH_ResourceManager_GetMediaBase64Data()
888
889```
890ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64Data (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue, uint64_t * resultLen, uint32_t density )
891```
892
893**Description**
894
895Obtains the Base64 code of the media resource with the specified screen density based on the specified resource ID.
896
897**Since**: 12
898
899**Parameters**
900
901| Name| Description|
902| -------- | -------- |
903| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
904| resId | Resource ID.|
905| resultValue | Result of writing **resultValue**.|
906| resultLen | Length of media written to **resultLen**.|
907| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
908
909**Returns**
910
911SUCCESS = 0: Operation succeeded.
912
913ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
914
915ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
916
917ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
918
919ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
920
921
922### OH_ResourceManager_GetMediaBase64DataByName()
923
924```
925ResourceManager_ErrorCode OH_ResourceManager_GetMediaBase64DataByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue, uint64_t * resultLen, uint32_t density )
926```
927
928**Description**
929
930Obtains the Base64 code of the media resource with the specified screen density based on the specified resource name.
931
932**Since**: 12
933
934**Parameters**
935
936| Name| Description|
937| -------- | -------- |
938| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
939| resName | Resource name.|
940| resultValue | Result of writing **resultValue**.|
941| resultLen | Length of media written to **resultLen**.|
942| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
943
944**Returns**
945
946SUCCESS = 0: Operation succeeded.
947
948ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
949
950ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
951
952ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
953
954ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
955
956
957### OH_ResourceManager_GetMediaByName()
958
959```
960ResourceManager_ErrorCode OH_ResourceManager_GetMediaByName (const NativeResourceManager * mgr, const char * resName, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density = 0 )
961```
962
963Description
964
965Obtains the content of the media resource with the specified screen density based on the specified resource name.
966
967**Since**: 12
968
969**Parameters**
970
971| Name| Description|
972| -------- | -------- |
973| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
974| resName | Resource name.|
975| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used.|
976| resultValue | Result of writing **resultValue**.|
977| resultLen | Length of media written to **resultLen**.|
978
979**Returns**
980
981SUCCESS = 0: Operation succeeded.
982
983ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
984
985ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
986
987ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
988
989ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
990
991
992### OH_ResourceManager_GetMediaData()
993
994```
995ResourceManager_ErrorCode OH_ResourceManager_GetMediaData (const NativeResourceManager * mgr, uint32_t resId, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density )
996```
997
998**Description**
999
1000Obtains the content of the media resource with the specified screen density based on the specified resource ID.
1001
1002**Since**: 12
1003
1004**Parameters**
1005
1006| Name| Description|
1007| -------- | -------- |
1008| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1009| resId | Resource ID.|
1010| resultValue | Result of writing **resultValue**.|
1011| resultLen | Length of media written to **resultLen**.|
1012| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1013
1014**Returns**
1015
1016SUCCESS = 0: Operation succeeded.
1017
1018ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1019
1020ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1021
1022ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1023
1024ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1025
1026
1027### OH_ResourceManager_GetMediaDataByName()
1028
1029```
1030ResourceManager_ErrorCode OH_ResourceManager_GetMediaDataByName (const NativeResourceManager * mgr, const char * resName, uint8_t ** resultValue, uint64_t * resultLen, uint32_t density )
1031```
1032
1033**Description**
1034
1035Obtains the content of the media resource with the specified screen density based on the specified resource name.
1036
1037**Since**: 12
1038
1039**Parameters**
1040
1041| Name| Description|
1042| -------- | -------- |
1043| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1044| resName | Resource name.|
1045| resultValue | Result of writing **resultValue**.|
1046| resultLen | Length of media written to **resultLen**.|
1047| density | Screen density. This parameter is optional. For details about the value range, see [ScreenDensity](#screendensity). The default value is **0**, indicating that the current system screen density (in DPI) is used. If this parameter is not required, set it to **0**.|
1048
1049**Returns**
1050
1051SUCCESS = 0: Operation succeeded.
1052
1053ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1054
1055ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1056
1057ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1058
1059ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1060
1061
1062### OH_ResourceManager_GetPluralString()
1063
1064```
1065ResourceManager_ErrorCode OH_ResourceManager_GetPluralString (const NativeResourceManager * mgr, uint32_t resId, uint32_t num, char ** resultValue )
1066```
1067
1068**Description**
1069
1070Obtains singular and plural strings based on the specified resource ID.
1071
1072After using this API, you need to call **free()** to release the memory of the strings.
1073
1074**Since**: 12
1075
1076**Parameters**
1077
1078| Name| Description|
1079| -------- | -------- |
1080| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1081| resId | Resource ID.|
1082| num | Number.|
1083| resultValue | Result of writing **resultValue**.|
1084
1085**Returns**
1086
1087SUCCESS = 0: Operation succeeded.
1088
1089ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1090
1091ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1092
1093ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1094
1095ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1096
1097ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1098
1099
1100### OH_ResourceManager_GetPluralStringByName()
1101
1102```
1103ResourceManager_ErrorCode OH_ResourceManager_GetPluralStringByName (const NativeResourceManager * mgr, const char * resName, uint32_t num, char ** resultValue )
1104```
1105
1106**Description**
1107
1108Obtains singular and plural strings based on the specified resource name.
1109
1110After using this API, you need to call **free()** to release the memory of the strings.
1111
1112**Since**: 12
1113
1114**Parameters**
1115
1116| Name| Description|
1117| -------- | -------- |
1118| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1119| resName | Resource name.|
1120| num | Number.|
1121| resultValue | Result of writing **resultValue**.|
1122
1123**Returns**
1124
1125SUCCESS = 0: Operation succeeded.
1126
1127ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1128
1129ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1130
1131ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1132
1133ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1134
1135ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1136
1137
1138### OH_ResourceManager_GetString()
1139
1140```
1141ResourceManager_ErrorCode OH_ResourceManager_GetString (const NativeResourceManager * mgr, uint32_t resId, char ** resultValue,  ... )
1142```
1143
1144**Description**
1145
1146Obtains a **string** resource based on the specified resource ID.
1147
1148The obtain common string resources, use **OH_ResourceManager_GetString(mgr, resId, resultValue)**. The obtain formatted string resources with the **d**, **s**, and **f** placeholders, use **OH_ResourceManager_GetString(mgr, resId, resultValue, 10, "format", 10.10)**. After using this API, you need to call **free()** to release the memory.
1149
1150**Since**: 12
1151
1152**Parameters**
1153
1154| Name| Description|
1155| -------- | -------- |
1156| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1157| resId | Resource ID.|
1158| resultValue | Result of writing **resultValue**.|
1159| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float.|
1160
1161**Returns**
1162
1163SUCCESS = 0: Operation succeeded.
1164
1165ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1166
1167ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1168
1169ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1170
1171ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1172
1173ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1174
1175
1176### OH_ResourceManager_GetStringArray()
1177
1178```
1179ResourceManager_ErrorCode OH_ResourceManager_GetStringArray (const NativeResourceManager * mgr, uint32_t resId, char *** resultValue, uint32_t * resultLen )
1180```
1181
1182**Description**
1183
1184Obtains a string array based on the specified resource ID.
1185
1186After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of the string array.
1187
1188**Since**: 12
1189
1190**Parameters**
1191
1192| Name| Description|
1193| -------- | -------- |
1194| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1195| resId | Resource ID.|
1196| resultValue | Result of writing **resultValue**.|
1197| resultLen | Length of **StringArray** written to **resultLen**.|
1198
1199**Returns**
1200
1201SUCCESS = 0: Operation succeeded.
1202
1203ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1204
1205ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1206
1207ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1208
1209ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1210
1211ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1212
1213
1214### OH_ResourceManager_GetStringArrayByName()
1215
1216```
1217ResourceManager_ErrorCode OH_ResourceManager_GetStringArrayByName (const NativeResourceManager * mgr, const char * resName, char *** resultValue, uint32_t * resultLen )
1218```
1219
1220**Description**
1221
1222Obtains a string array based on the specified resource name.
1223
1224After using this API, you need to call **OH_ResourceManager_ReleaseStringArray()** to release the memory of the string array.
1225
1226**Since**: 12
1227
1228**Parameters**
1229
1230| Name| Description|
1231| -------- | -------- |
1232| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1233| resName | Resource name.|
1234| resultValue | Result of writing **resultValue**.|
1235| resultLen | Length of **StringArray** written to **resultLen**.|
1236
1237**Returns**
1238
1239SUCCESS = 0: Operation succeeded.
1240
1241ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1242
1243ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1244
1245ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1246
1247ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1248
1249ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1250
1251
1252### OH_ResourceManager_GetStringByName()
1253
1254```
1255ResourceManager_ErrorCode OH_ResourceManager_GetStringByName (const NativeResourceManager * mgr, const char * resName, char ** resultValue,  ... )
1256```
1257
1258**Description**
1259
1260Obtains a **string** resource based on the specified resource name.
1261
1262The obtain common string resources, use **OH_ResourceManager_GetString(mgr, resName, resultValue)**. The obtain formatted string resources with the **%d**, **%s**, and **%f** placeholders, use **OH_ResourceManager_GetString(mgr, resName, resultValue, 10, "format", 10.10)**. After using this API, you need to call **free()** to release the memory.
1263
1264**Since**: 12
1265
1266**Parameters**
1267
1268| Name| Description|
1269| -------- | -------- |
1270| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1271| resName | Resource name.|
1272| resultValue | Result of writing **resultValue**.|
1273| ... | Variable representing formatted string resources. Supported types include const char\*, int, and float.|
1274
1275**Returns**
1276
1277SUCCESS = 0: Operation succeeded.
1278
1279ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1280
1281ERROR_CODE_RES_ID_NOT_FOUND 9001003 - The resource name is invalid.
1282
1283ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004 - No matching resource is found based on the resource name.
1284
1285ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1286
1287ERROR_CODE_OUT_OF_MEMORY 9001100: The memory overflows.
1288
1289
1290### OH_ResourceManager_GetSymbol()
1291
1292```
1293ResourceManager_ErrorCode OH_ResourceManager_GetSymbol (const NativeResourceManager * mgr, uint32_t resId, uint32_t * resultValue )
1294```
1295
1296**Description**
1297
1298Obtains a **symbol** resource based on the specified resource ID.
1299
1300**Since**: 12
1301
1302**Parameters**
1303
1304| Name| Description|
1305| -------- | -------- |
1306| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1307| resId | Resource ID.|
1308| resultValue | Result of writing **resultValue**.|
1309
1310**Returns**
1311
1312SUCCESS = 0: Operation succeeded.
1313
1314ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1315
1316ERROR_CODE_RES_ID_NOT_FOUND 9001001 - The resource ID is invalid.
1317
1318ERROR_CODE_RES_NOT_FOUND_BY_ID 9001002 - No matching resource is found based on the resource ID.
1319
1320ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1321
1322
1323### OH_ResourceManager_GetSymbolByName()
1324
1325```
1326ResourceManager_ErrorCode OH_ResourceManager_GetSymbolByName (const NativeResourceManager * mgr, const char * resName, uint32_t * resultValue )
1327```
1328
1329**Description**
1330
1331Obtains a **symbol** resource based on the specified resource name.
1332
1333**Since**: 12
1334
1335**Parameters**
1336
1337| Name| Description|
1338| -------- | -------- |
1339| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1340| resName | Resource name.|
1341| resultValue | Result of writing **resultValue**.|
1342
1343**Returns**
1344
1345SUCCESS = 0: Operation succeeded.
1346
1347ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1348
1349ERROR_CODE_RES_ID_NOT_FOUND 9001003: The resource name is invalid.
1350
1351ERROR_CODE_RES_NOT_FOUND_BY_ID 9001004: No matching resource is found based on the resource name.
1352
1353ERROR_CODE_RES_REF_TOO_MUCH 9001006 - Resources are cyclically referenced.
1354
1355
1356### OH_ResourceManager_ReleaseConfiguration()
1357
1358```
1359ResourceManager_ErrorCode OH_ResourceManager_ReleaseConfiguration (ResourceManager_Configuration * configuration)
1360```
1361
1362**Description**
1363
1364Releases the memory requested by using **OH_ResourceManager_GetConfiguration()**.
1365
1366**Since**: 12
1367
1368**Parameters**
1369
1370| Name| Description|
1371| -------- | -------- |
1372| configuration | Configuration object whose memory needs to be released.|
1373
1374**Returns**
1375
1376SUCCESS = 0: Operation succeeded.
1377
1378ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1379
1380
1381### OH_ResourceManager_ReleaseStringArray()
1382
1383```
1384ResourceManager_ErrorCode OH_ResourceManager_ReleaseStringArray (char *** resValue, uint32_t len )
1385```
1386
1387**Description**
1388
1389Releases the memory of the string array.
1390
1391**Since**: 12
1392
1393**Parameters**
1394
1395| Name| Description|
1396| -------- | -------- |
1397| resValue | String array whose memory needs to be released.|
1398| len | Length of the string array.|
1399
1400**Returns**
1401
1402SUCCESS = 0: Operation succeeded.
1403
1404ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1405
1406
1407### OH_ResourceManager_RemoveResource()
1408
1409```
1410ResourceManager_ErrorCode OH_ResourceManager_RemoveResource (const NativeResourceManager * mgr, const char * path )
1411```
1412
1413**Description**
1414
1415Removes overlay resources when an application is running.
1416
1417**Since**: 12
1418
1419**Parameters**
1420
1421| Name| Description|
1422| -------- | -------- |
1423| mgr | Pointer to the [NativeResourceManager](rawfile.md#nativeresourcemanager) object. You can obtain the pointer by using [OH_ResourceManager_InitNativeResourceManager](rawfile.md#oh_resourcemanager_initnativeresourcemanager).|
1424| path | Resource path.|
1425
1426**Returns**
1427
1428SUCCESS = 0: Operation succeeded.
1429
1430ERROR_CODE_INVALID_INPUT_PARAMETER 401 - The input parameter is invalid. Possible causes: 1. The parameter type is incorrect. 2. Parameter verification failed.
1431
1432ERROR_CODE_OVERLAY_RES_PATH_INVALID 9001010 - The resource path is invalid.
1433