Tizen Native API
5.5
|
The App Common API provides functions for getting information about the application.
#include <app_common.h>
The App common API provides common APIs that can be used at UI application and Service application. This API provides interfaces for getting information about the application.
The Tizen native application consists of structured directories to manage the application executable file, library files, resource files, and data. When you build the application, the Tizen SDK packages those as an application package for distribution.
Directories | Description |
---|---|
<package id> | The fully qualified name of an application (such as org.tizen.calculator). |
bin | The executable file of the application. |
lib | The application library files |
res | The root directory in which all resource files are located. The application cannot write and modify any resource files |
data | The root directory in which an application's private data is located. The application can read and write its own data files in the application's data directory. |
shared/ | The shared directory for sharing with other applications. |
The API provides functions for obtaining an application's package name and absolute path to specified resources like Image, Sound, Video, UI layout (EDJ), and so on. It also provides functions to:
Functions | |
int | app_event_get_low_memory_status (app_event_info_h event_info, app_event_low_memory_status_e *status) |
Gets the low memory status from the given event info. | |
int | app_event_get_low_battery_status (app_event_info_h event_info, app_event_low_battery_status_e *status) |
Gets the low battery status from given event info. | |
int | app_event_get_language (app_event_info_h event_info, char **lang) |
Gets the language from the given event info. | |
int | app_event_get_region_format (app_event_info_h event_info, char **region) |
Gets the region format from the given event info. | |
int | app_event_get_device_orientation (app_event_info_h event_info, app_device_orientation_e *orientation) |
Gets the device orientation from the given event info. | |
int | app_event_get_suspended_state (app_event_info_h event_info, app_suspended_state_e *state) |
Gets the suspended state of the application from the given event info. | |
int | app_get_id (char **id) |
Gets the ID of the application. | |
int | app_get_name (char **name) |
Gets the localized name of the application. | |
int | app_get_version (char **version) |
Gets the version of the application package. | |
char * | app_get_data_path (void) |
Gets the absolute path to the application's data directory which is used to store private data of the application. | |
char * | app_get_cache_path (void) |
Gets the absolute path to the application's cache directory which is used to store temporary data of the application. | |
char * | app_get_resource_path (void) |
Gets the absolute path to the application resource directory. The resource files are delivered with the application package. | |
char * | app_get_shared_data_path (void) |
Gets the absolute path to the application's shared data directory which is used to share data with other applications. | |
char * | app_get_shared_resource_path (void) |
Gets the absolute path to the application's shared resource directory which is used to share resources with other applications. | |
char * | app_get_shared_trusted_path (void) |
Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications. | |
char * | app_get_external_data_path (void) |
Gets the absolute path to the application's external data directory which is used to store data of the application. | |
char * | app_get_external_cache_path (void) |
Gets the absolute path to the application's external cache directory which is used to store temporary data of the application. | |
char * | app_get_external_shared_data_path (void) TIZEN_DEPRECATED_API |
Gets the absolute path to the application's external shared data directory which is used to share data with other applications. | |
char * | app_get_tep_resource_path (void) |
Gets the absolute path to the application's TEP (Tizen Expansion Package) directory. The resource files are delivered with the expansion package. | |
int | app_get_display_state (app_display_state_e *display_state) |
Gets the display state. | |
int | app_watchdog_timer_enable (void) |
Sends the enable request to activate the watchdog timer. | |
int | app_watchdog_timer_disable (void) |
Sends the disable request to deactivate the watchdog timer. | |
int | app_watchdog_timer_kick (void) |
Sends the kick request to reset the watchdog timer. | |
Typedefs | |
typedef struct app_event_handler * | app_event_handler_h |
The event handler that returned from add event handler function to handle. | |
typedef struct app_event_info * | app_event_info_h |
The system event information handle. | |
typedef void(* | app_event_cb )(app_event_info_h event_info, void *user_data) |
The system event callback function. |
typedef void(* app_event_cb)(app_event_info_h event_info, void *user_data) |
The system event callback function.
[in] | event_info | The system event information |
[in] | user_data | The user data passed from the add event handler function |
typedef struct app_event_handler* app_event_handler_h |
The event handler that returned from add event handler function to handle.
typedef struct app_event_info* app_event_info_h |
The system event information handle.
Enumeration for device orientation.
enum app_display_state_e |
enum app_event_type_e |
Enumeration for system events.
APP_EVENT_LOW_MEMORY |
The low memory event |
APP_EVENT_LOW_BATTERY |
The low battery event |
APP_EVENT_LANGUAGE_CHANGED |
The system language changed event |
APP_EVENT_DEVICE_ORIENTATION_CHANGED |
The device orientation changed event |
APP_EVENT_REGION_FORMAT_CHANGED |
The region format changed event |
APP_EVENT_SUSPENDED_STATE_CHANGED |
The suspended state changed event of the application (since 2.4)
|
APP_EVENT_UPDATE_REQUESTED |
The update requested event (Since 3.0) This event can occur when an app needs to be updated. It is dependent on target devices. |
int app_event_get_device_orientation | ( | app_event_info_h | event_info, |
app_device_orientation_e * | orientation | ||
) |
Gets the device orientation from the given event info.
[in] | event_info | The system event info |
[out] | orientation | The device orientation changed |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
int app_event_get_language | ( | app_event_info_h | event_info, |
char ** | lang | ||
) |
Gets the language from the given event info.
[in] | event_info | The system event info |
[out] | lang | The language changed |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
int app_event_get_low_battery_status | ( | app_event_info_h | event_info, |
app_event_low_battery_status_e * | status | ||
) |
Gets the low battery status from given event info.
[in] | event_info | The system event info |
[out] | status | The low battery status |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
int app_event_get_low_memory_status | ( | app_event_info_h | event_info, |
app_event_low_memory_status_e * | status | ||
) |
Gets the low memory status from the given event info.
[in] | event_info | The system event info |
[out] | status | The low memory status |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
int app_event_get_region_format | ( | app_event_info_h | event_info, |
char ** | region | ||
) |
Gets the region format from the given event info.
[in] | event_info | The system event info |
[out] | region | The region format changed |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
int app_event_get_suspended_state | ( | app_event_info_h | event_info, |
app_suspended_state_e * | state | ||
) |
Gets the suspended state of the application from the given event info.
[in] | event_info | The handle for getting the suspended state |
[out] | state | The suspended state of the application |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | Invalid event context |
char* app_get_cache_path | ( | void | ) |
Gets the absolute path to the application's cache directory which is used to store temporary data of the application.
An application can read and write its own files in the application's cache directory.
char* app_get_data_path | ( | void | ) |
Gets the absolute path to the application's data directory which is used to store private data of the application.
An application can read and write its own files in the application's data directory.
int app_get_display_state | ( | app_display_state_e * | display_state | ) |
Gets the display state.
[out] | display_state | The display state |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_NOT_SUPPORTED | Not supported |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | The display is in an unknown state. |
char* app_get_external_cache_path | ( | void | ) |
Gets the absolute path to the application's external cache directory which is used to store temporary data of the application.
An application can read and write its own files in the application's external cache directory.
char* app_get_external_data_path | ( | void | ) |
Gets the absolute path to the application's external data directory which is used to store data of the application.
An application can read and write its own files in the application's external data directory.
char* app_get_external_shared_data_path | ( | void | ) |
Gets the absolute path to the application's external shared data directory which is used to share data with other applications.
An application can read and write its own files in the application's external shared data directory, and others can only read the files.
int app_get_id | ( | char ** | id | ) |
Gets the ID of the application.
[out] | id | The ID of the application |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | The application is launched illegally, not launched by the launch system |
APP_ERROR_OUT_OF_MEMORY | Out of memory |
int app_get_name | ( | char ** | name | ) |
Gets the localized name of the application.
[out] | name | The name of the application |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | The application is launched illegally, not launched by the launch system |
APP_ERROR_OUT_OF_MEMORY | Out of memory |
char* app_get_resource_path | ( | void | ) |
Gets the absolute path to the application resource directory. The resource files are delivered with the application package.
An application can only read its own files in the application's resource directory.
char* app_get_shared_data_path | ( | void | ) |
Gets the absolute path to the application's shared data directory which is used to share data with other applications.
An application can read and write its own files in the application's shared data directory and others can only read the files.
APP_ERROR_NONE | Success |
APP_ERROR_PERMISSION_DENIED | Permission denied |
APP_ERROR_OUT_OF_MEMORY | Out of memory |
char* app_get_shared_resource_path | ( | void | ) |
Gets the absolute path to the application's shared resource directory which is used to share resources with other applications.
An application can read its own files in the application's shared resource directory, and others can only read the files.
char* app_get_shared_trusted_path | ( | void | ) |
Gets the absolute path to the application's shared trusted directory which is used to share data with a family of trusted applications.
An application can read and write its own files in the application's shared trusted directory and the family applications signed with the same certificate can read and write the files in the shared trusted directory.
char* app_get_tep_resource_path | ( | void | ) |
Gets the absolute path to the application's TEP (Tizen Expansion Package) directory. The resource files are delivered with the expansion package.
An application can only read its own files in the application's TEP (Tizen Expansion Package) directory.
int app_get_version | ( | char ** | version | ) |
Gets the version of the application package.
[out] | version | The version of the application |
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_PARAMETER | Invalid parameter |
APP_ERROR_INVALID_CONTEXT | The application is launched illegally, not launched by the launch system |
APP_ERROR_OUT_OF_MEMORY | Out of memory |
int app_watchdog_timer_disable | ( | void | ) |
Sends the disable request to deactivate the watchdog timer.
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_CONTEXT | Invalid context |
int app_watchdog_timer_enable | ( | void | ) |
Sends the enable request to activate the watchdog timer.
0
on success, otherrwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_CONTEXT | Invalid context |
int app_watchdog_timer_kick | ( | void | ) |
Sends the kick request to reset the watchdog timer.
0
on success, otherwise a negative error value APP_ERROR_NONE | Successful |
APP_ERROR_INVALID_CONTEXT | Invalid context |