Tizen Native API
7.0
|
Launches or exits serviceApp.
Required Header
#include <service_app.h>
Overview
The Service Application API provides functions for handling Tizen service application state changes or system events. This API provides interfaces for the following three categories:
- Starting or exiting the main event loop.
- Registering callbacks for application state change events.
- Registering callbacks for basic system events.
Functions | |
int | service_app_add_event_handler (app_event_handler_h *handler, app_event_type_e event_type, app_event_cb callback, void *user_data) |
Adds the system event handler. | |
int | service_app_remove_event_handler (app_event_handler_h event_handler) |
Removes registered event handler. | |
int | service_app_main (int argc, char **argv, service_app_lifecycle_callback_s *callback, void *user_data) |
Runs the main loop of the application until service_app_exit() is called. | |
void | service_app_exit (void) |
Exits the main loop of the application. | |
Typedefs | |
typedef bool(* | service_app_create_cb )(void *user_data) |
Called at the start of the agent application. | |
typedef void(* | service_app_terminate_cb )(void *user_data) |
Called once after the main loop of the agent application exits. | |
typedef void(* | service_app_control_cb )(app_control_h app_control, void *user_data) |
Called when another application sends the launch request to the agent application. |
Typedef Documentation
typedef void(* service_app_control_cb)(app_control_h app_control, void *user_data) |
Called when another application sends the launch request to the agent application.
- Since :
- 2.3
- Parameters:
-
[in] app_control The handle to the app_control [in] user_data The user data passed from the callback registration function
typedef bool(* service_app_create_cb)(void *user_data) |
Called at the start of the agent application.
- Since :
- 2.3
- Parameters:
-
[in] user_data The user data passed from the callback registration function
- Returns:
true
on success, otherwisefalse
- Precondition:
- service_app_main() will invoke this callback function.
typedef void(* service_app_terminate_cb)(void *user_data) |
Called once after the main loop of the agent application exits.
- Since :
- 2.3
- Parameters:
-
[in] user_data The user data passed from the callback registration function
Function Documentation
int service_app_add_event_handler | ( | app_event_handler_h * | handler, |
app_event_type_e | event_type, | ||
app_event_cb | callback, | ||
void * | user_data | ||
) |
Adds the system event handler.
- Since :
- 2.3
- Remarks:
- The service application can handle low memory event, low battery event, language setting changed event and region format changed event.
- Parameters:
-
[out] handler The event handler [in] event_type The system event type [in] callback The callback function [in] user_data The user data to be passed to the callback function
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
APP_ERROR_NONE Successful APP_ERROR_INVALID_PARAMETER Invalid parameter APP_ERROR_OUT_OF_MEMORY Out of memory
void service_app_exit | ( | void | ) |
Exits the main loop of the application.
The main loop of the application stops and service_app_terminate_cb() is invoked.
- Since :
- 2.3
int service_app_main | ( | int | argc, |
char ** | argv, | ||
service_app_lifecycle_callback_s * | callback, | ||
void * | user_data | ||
) |
Runs the main loop of the application until service_app_exit() is called.
This function is the main entry point of the Tizen service application. This main loop supports event handling for the GMainLoop and the Ecore Main Loop.
- Since :
- 2.3
- Parameters:
-
[in] argc The argument count [in] argv The argument vector [in] callback The set of callback functions to handle application events [in] user_data The user data to be passed to the callback functions
- Returns:
0
on success, otherwise a negative error value.
- Return values:
-
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_ALREADY_RUNNING The main loop has already started
int service_app_remove_event_handler | ( | app_event_handler_h | event_handler | ) |
Removes registered event handler.
- Since :
- 2.3
- Parameters:
-
[in] event_handler The event handler
- Returns:
0
on success, otherwise a negative error value
- Return values:
-
APP_ERROR_NONE Successful APP_ERROR_INVALID_PARAMETER Invalid parameter
- See also:
- service_app_add_event_handler()