The Resource Manager API provides functions to get/set the common resource for multiple devices.
Required Header
#include <app_resource_manager.h>
Overview
The Resource Manager API provides functions to use different resources(images, layout, sounds) between each device having different device specifications. For example, if you want to change button image of the application depending on the device's current language setting, put resource files into different folders which are managed by SDK as the same filename. Then call app_resource_manager_get() with resource ID described below to get the appropriate resource filepath, then OS will choose resources for specific devices. You should get the path of the resource file that is managed by the resource manager with app_resource_manager_get() API. Tizen may remove unnecessary resource files for a certain device, so you may fail to access if you access the resource file with the path that is not received with app_resource_manager_get() API. Make sure app_resource_manager_init() should be called first and app_resource_manager_release should be called after using resource manager.
Resource ID
Resource ID is an identifier for specific resource. It consists of sub directories and filename including its extension. Same resources are located at different locations with same filename for supporting multiple devices. If you want to get actual filename with given resourceID, refer app_resource_manager_get().
Resource Type
For now, 4 resource types are supported. Resource which has same resource type are grouped as folder. Folder name is irrelevant with its actual resource type. The managed folders for each type will be generated by SDK tools. In source codes, you can use resource types listed below. (Types will be added for further needs)
TYPE | Description |
RSC_TYPE_IMAGE | Image resources. |
RSC_TYPE_LAYOUT | Application's layout to be displayed. |
RSC_TYPE_SOUND | Sound, audio resources. |
RSC_TYPE_BIN | All other resources to be needed, but not specified above. |
Matching Algorithm
Matching Algorithm
Enumeration Type Documentation
Enumeration for Resource Types.
- Since :
- 2.4
- Enumerator:
APP_RESOURCE_TYPE_IMAGE |
Image
|
APP_RESOURCE_TYPE_LAYOUT |
Edje
|
APP_RESOURCE_TYPE_SOUND |
Sound
|
APP_RESOURCE_TYPE_BIN |
Bin
|
Enumeration for App Resource Manager Error.
- Since :
- 2.4
- Enumerator:
APP_RESOURCE_ERROR_NONE |
Successful
|
APP_RESOURCE_ERROR_INVALID_PARAMETER |
Invalid parameter
|
APP_RESOURCE_ERROR_OUT_OF_MEMORY |
Out of memory
|
APP_RESOURCE_ERROR_IO_ERROR |
I/O error
|
Function Documentation
Converts resource ID to path name.
- Since :
- 2.4
- Parameters:
-
- See also:
- app_resource_e
- Parameters:
-
[in] | id | Resource ID |
[out] | path | The name of requested resource on success, otherwise NULL |
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- See also:
- app_resource_manager_init()
Creates resource manager and get from db.
- Since :
- 2.4
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- See also:
- app_resource_manager_release()
Destroys resource manager.
- Since :
- 2.4
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
- See also:
- app_resource_manager_init()