Tizen Native API

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

Required Header

#include <app_manager.h>

Overview

The Application Manager API provides information about applications. There are several different sorts of queries. Two iterator functions step through a list of applications. One is used in running applications(app_manager_foreach_app_context()), and the other is used in available ("installed") but not necessarily running applications(app_manager_foreach_app_info()). Each will call a callback function, passing the package name of each application found. A query function will respond whether the application represented by a particular package name is running. Other query functions return static information about an application, such as a name, a type, an icon path, or a version. The API provides functions to manage applications also. By using them, it is possible to resume(app_manager_resume_app) applications.

Functions

int app_manager_foreach_app_context (app_manager_app_context_cb callback, void *user_data)
 Retrieves all application contexts of running applications.
int app_manager_get_app_context (const char *app_id, app_context_h *app_context)
 Gets the application context for the given ID of the application.
int app_manager_get_app_id (pid_t pid, char **app_id)
 Gets the ID of the application for the given process ID.
int app_manager_is_running (const char *app_id, bool *running)
 Checks whether the application with the given package name is running.
int app_manager_resume_app (app_context_h app_context)
 Resumes the application.
int app_manager_foreach_app_info (app_manager_app_info_cb callback, void *user_data)
 Retrieves all installed applications information.
int app_manager_get_app_info (const char *app_id, app_info_h *app_info)
 Gets the application information for the given application ID.
int app_manager_get_shared_data_path (const char *app_id, char **path)
 Gets the absolute path to the shared data directory of the application specified with an application ID.
int app_manager_get_shared_resource_path (const char *app_id, char **path)
 Gets the absolute path to the shared resource directory of the application specified with an application ID.
int app_manager_get_shared_trusted_path (const char *app_id, char **path)
 Gets the absolute path to the shared trusted directory of the application specified with an application ID.
int app_manager_get_external_shared_data_path (const char *app_id, char **path)
 Gets the absolute path to the shared data directory of the application specified with an application ID.

Typedefs

typedef bool(* app_manager_app_context_cb )(app_context_h app_context, void *user_data)
 Called to get the application context once for each running application.
typedef bool(* app_manager_app_info_cb )(app_info_h app_info, void *user_data)
 Called to get the application information once for each installed application.

Typedef Documentation

typedef bool(* app_manager_app_context_cb)(app_context_h app_context, void *user_data)

Called to get the application context once for each running application.

Since :
2.3.1
Parameters:
[in]app_contextThe application context of each running application
[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:
app_manager_foreach_app_context() will invoke this callback.
See also:
app_manager_foreach_app_context()
typedef bool(* app_manager_app_info_cb)(app_info_h app_info, void *user_data)

Called to get the application information once for each installed application.

Since :
2.3.1
Parameters:
[in]app_infoThe application information of each installed application
[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:
app_manager_foreach_app_info() will invoke this callback.
See also:
app_manager_foreach_app_info()

Enumeration Type Documentation

Enumerations for Application Manager Error .

Since :
2.3.1
Enumerator:
APP_MANAGER_ERROR_NONE 

Successful

APP_MANAGER_ERROR_INVALID_PARAMETER 

Invalid parameter

APP_MANAGER_ERROR_OUT_OF_MEMORY 

Out of memory

APP_MANAGER_ERROR_IO_ERROR 

Internal I/O error

APP_MANAGER_ERROR_NO_SUCH_APP 

No such application

APP_MANAGER_ERROR_DB_FAILED 

Database error

APP_MANAGER_ERROR_INVALID_PACKAGE 

Invalid package name

APP_MANAGER_ERROR_APP_NO_RUNNING 

App is not running

APP_MANAGER_ERROR_REQUEST_FAILED 

Internal aul request error

APP_MANAGER_ERROR_PERMISSION_DENIED 

Permission denied


Function Documentation

int app_manager_foreach_app_context ( app_manager_app_context_cb  callback,
void *  user_data 
)

Retrieves all application contexts of running applications.

Since :
2.3.1
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:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
This function invokes app_manager_app_context_cb() for each application context.
See also:
app_manager_app_context_cb()
int app_manager_foreach_app_info ( app_manager_app_info_cb  callback,
void *  user_data 
)

Retrieves all installed applications information.

Since :
2.3.1
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:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
Postcondition:
This function invokes app_manager_app_info_cb() for each application information.
See also:
app_manager_app_info_cb()
int app_manager_get_app_context ( const char *  app_id,
app_context_h app_context 
)

Gets the application context for the given ID of the application.

Since :
2.3.1
Remarks:
This function returns APP_MANAGER_ERROR_NO_SUCH_APP if the application with the given application ID is not running.
You must release app_context using app_context_destroy().
Parameters:
[in]app_idThe ID of the application
[out]app_contextThe application context of the given application ID
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
int app_manager_get_app_id ( pid_t  pid,
char **  app_id 
)

Gets the ID of the application for the given process ID.

Since :
2.3.1
Remarks:
This function returns APP_MANAGER_ERROR_NO_SUCH_APP if the application with the given process ID is not valid.
You must release app_id using free().
Parameters:
[in]pidThe process ID of the application
[out]app_idThe ID of the application
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int app_manager_get_app_info ( const char *  app_id,
app_info_h app_info 
)

Gets the application information for the given application ID.

Since :
2.3.1
Remarks:
You must release app_info using app_info_destroy().
Parameters:
[in]app_idThe ID of the application
[out]app_infoThe application information for the given application ID
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
int app_manager_get_external_shared_data_path ( const char *  app_id,
char **  path 
)

Gets the absolute path to the shared data directory of the application specified with an application ID.

An application can only read the files of other application's shared data directory.

Since :
2.3.1
Remarks:
The specified path should be released.
Parameters:
[in]app_idThe ID of the application
[in,out]pathThe absolute path to the shared data directory of the application specified with the app_id
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int app_manager_get_shared_data_path ( const char *  app_id,
char **  path 
)

Gets the absolute path to the shared data directory of the application specified with an application ID.

An application can only read the files of other application's shared data directory.

Since :
2.3.1
Remarks:
The specified path should be released.
Parameters:
[in]app_idThe ID of the application
[in,out]pathThe absolute path to the shared data directory of the application specified with the app_id
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int app_manager_get_shared_resource_path ( const char *  app_id,
char **  path 
)

Gets the absolute path to the shared resource directory of the application specified with an application ID.

An application can only read the files of other application's shared resource directory.

Since :
2.3.1
Remarks:
The specified path should be released.
Parameters:
[in]app_idThe ID of the application
[in,out]pathThe absolute path to the shared resource directory of the application specified with the app_id
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int app_manager_get_shared_trusted_path ( const char *  app_id,
char **  path 
)

Gets the absolute path to the shared trusted directory of the application specified with an application ID.

An application signed with the same certificate can read and write the files of other application's shared trusted directory.

Since :
2.3.1
Remarks:
The specified path should be released.
Parameters:
[in]app_idThe ID of the application
[in,out]pathThe absolute path to the shared trusted directory of the application specified with the app_id
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_NO_SUCH_APPNo such application
APP_MANAGER_ERROR_OUT_OF_MEMORYOut of memory
int app_manager_is_running ( const char *  app_id,
bool *  running 
)

Checks whether the application with the given package name is running.

Since :
2.3.1
Parameters:
[in]app_idThe ID of the application
[out]runningtrue if the application is running,
otherwise false if not running
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
int app_manager_resume_app ( app_context_h  app_context)

Resumes the application.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/appmanager.launch
Parameters:
[in]app_contextThe application context
Returns:
0 on success, otherwise a negative error value
Return values:
APP_MANAGER_ERROR_NONESuccessful
APP_MANAGER_ERROR_INVALID_PARAMETERInvalid parameter
APP_MANAGER_ERROR_APP_NO_RUNNINGApp is not running
APP_MANAGER_ERROR_REQUEST_FAILEDInternal resume error
APP_MANAGER_ERROR_PERMISSION_DENIEDPermission denied