Tizen Native API  6.0

The Component Manager API provides functions to get information about installed or running components and manage the components.

Required Header

#include <component_manager.h>

Overview

The Component Manager API provides functions to retrieve components information and to manager components. There are two iterator functions that retrieve components. One is component_manager_foreach_component_context(), which gets the information of running components, the other is component_manager_foreach_component_info(), which gets the information of installed components. The registered callback function is called as much as components exist in the list. An application can get the component's properties such as a name, a type, an icon path in the callback function. Resuming components or terminating background components are also supported to handle components.

Functions

int component_manager_foreach_component_context (component_manager_component_context_cb callback, void *user_data)
 Retrieves all component contexts of running components.
int component_manager_foreach_component_info (component_manager_component_info_cb callback, void *user_data)
 Retrieves all installed components information.
int component_manager_get_component_context (const char *comp_id, component_context_h *handle)
 Gets the component context for the given component ID.
int component_manager_get_component_info (const char *comp_id, component_info_h *handle)
 Gets the component information for the given component ID.
int component_manager_is_running (const char *comp_id, bool *running)
 Checks whether the component is running or not.
int component_manager_resume_component (component_context_h handle)
 Resumes the component.
int component_manager_terminate_bg_component (component_context_h handle)
 Terminates the background component.

Typedefs

typedef bool(* component_manager_component_context_cb )(component_context_h handle, void *user_data)
 Called whenever the application retrieves the context of running components.
typedef bool(* component_manager_component_info_cb )(component_info_h handle, void *user_data)
 Called whenever the application retrieves the information of installed components.

Typedef Documentation

typedef bool(* component_manager_component_context_cb)(component_context_h handle, void *user_data)

Called whenever the application retrieves the context of running components.

Since :
5.5
Remarks:
The handle should not be released. The handle can be used only in the callback. To use outside, make a copy using component_context_clone().
Parameters:
[in]handleThe component context of each running component
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop,
otherwise false to break out of the loop
Precondition:
component_manager_foreach_component_context() will invoke this callback.
See also:
component_manager_foreach_component_context()
typedef bool(* component_manager_component_info_cb)(component_info_h handle, void *user_data)

Called whenever the application retrieves the information of installed components.

Since :
5.5
Remarks:
The handle should not be released. The handle can be used only in the callback. To use outside, make a copy using component_info_clone().
Parameters:
[in]handleThe component information of each installed component
[in]user_dataThe user data passed from the foreach function
Returns:
true to continue with the next iteration of the loop,
otherwise false to break out of the loop
Precondition:
component_manager_foreach_component_info() will invoke this callback.
See also:
component_manager_foreach_component_info()

Enumeration Type Documentation

Enumerations for Component Manager Error.

Since :
5.5
Enumerator:
COMPONENT_MANAGER_ERROR_NONE 

Successful

COMPONENT_MANAGER_ERROR_INVALID_PARAMETER 

Invalid parameter

COMPONENT_MANAGER_ERROR_OUT_OF_MEMORY 

Out of memory

COMPONENT_MANAGER_ERROR_IO_ERROR 

Internal I/O error

COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT 

No such component

COMPONENT_MANAGER_ERROR_DB_FAILED 

Database error

COMPONENT_MANAGER_ERROR_INVALID_APPLICATION 

Invalid application ID

COMPONENT_MANAGER_ERROR_NOT_RUNNING 

Component is not running

COMPONENT_MANAGER_ERROR_LABEL_NOT_FOUND 

Label not found

COMPONENT_MANAGER_ERROR_PERMISSION_DENIED 

Permission denied


Function Documentation

Retrieves all component contexts of running components.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/packagemanager.info
Parameters:
[in]callbackThe callback function to invoke
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
See also:
component_manager_component_context_cb()

Retrieves all installed components information.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/packagemanager.info
Parameters:
[in]callbackThe callback function to invoke
[in]user_dataThe user data to be passed to the callback function
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
See also:
component_manager_component_info_cb()
int component_manager_get_component_context ( const char *  comp_id,
component_context_h handle 
)

Gets the component context for the given component ID.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/packagemanager.info
Remarks:
This function returns COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENT if the component with the given component ID is not running.
You MUST release handle using component_context_destroy().
Parameters:
[in]comp_idThe component ID
[out]handleThe component context of the given component ID
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
int component_manager_get_component_info ( const char *  comp_id,
component_info_h handle 
)

Gets the component information for the given component ID.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/packagemanager.info
Remarks:
You MUST release handle using component_info_destroy().
Parameters:
[in]comp_idThe component ID
[out]handleThe component information of the given component ID
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int component_manager_is_running ( const char *  comp_id,
bool *  running 
)

Checks whether the component is running or not.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/packagemanager.info
Parameters:
[in]comp_idThe component ID
[out]runningtrue if the component is running,
otherwise false if not running
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory

Resumes the component.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/appmanager.launch
Parameters:
[in]handleThe component context handle
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component

Terminates the background component.

Since :
5.5
Privilege Level:
public
Privilege:
http://tizen.org/privilege/appmanager.kill.bgapp
Remarks:
This function returns after it just sends a request for terminating a background component. Platform will decide if the target component could be terminated or not according to the state of the target component.
Parameters:
[in]handleThe component context handle
Returns:
0 on success, otherwise a negative error value
Return values:
COMPONENT_MANAGER_ERROR_NONESuccessful
COMPONENT_MANAGER_ERROR_PERMISSION_DENIEDPermission denied
COMPONENT_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
COMPONENT_MANAGER_ERROR_IO_ERRORI/O error
COMPONENT_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
COMPONENT_MANAGER_ERROR_NO_SUCH_COMPONENTNo such component