Tizen Native API
|
Functions | |
int | shortcut_add_to_home (const char *name, shortcut_type type, const char *uri, const char *icon, int allow_duplicate, result_cb_t result_cb, void *data) |
Supports the add_to_home feature, should invoke this. | |
Typedefs | |
typedef int(* | result_cb_t )(int ret, void *data) |
Called to receive the result of shortcut_add_to_home(). | |
typedef enum _shortcut_type | shortcut_type |
Enumeration for shortcut types. |
To enhance the Add to home feature.
#include <shortcut_manager.h>
It provides function of creating shortcut. Developers can use the "shortcut_add_to_home" API to create their shortcut to a home screen.
typedef int(* result_cb_t)(int ret, void *data) |
Called to receive the result of shortcut_add_to_home().
[in] | ret | The result value, it could be 0 if it succeeds to add a shortcut, otherwise it returns an errno |
[in] | data | The callback data |
0
if there is no error, otherwise errno typedef enum _shortcut_type shortcut_type |
Enumeration for shortcut types.
Basically, two types of shortcuts are defined. Every homescreen developer should support these types of shortcuts. Or return a proper errno to figure out why the application failed to add a shortcut. LAUNCH_BY_APP is used for adding a package itself as a shortcut. LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
enum _shortcut_type |
Enumeration for shortcut types.
Basically, two types of shortcuts are defined. Every homescreen developer should support these types of shortcuts. Or return a proper errno to figure out why the application failed to add a shortcut. LAUNCH_BY_APP is used for adding a package itself as a shortcut. LAUNCH_BY_URI is used for adding a shortcut for "uri" data.
enum shortcut_error_e |
Enumeration for values of shortcut response types.
int shortcut_add_to_home | ( | const char * | name, |
shortcut_type | type, | ||
const char * | uri, | ||
const char * | icon, | ||
int | allow_duplicate, | ||
result_cb_t | result_cb, | ||
void * | data | ||
) |
Supports the add_to_home feature, should invoke this.
Sync (or) Async: This is an asynchronous API.
[in] | name | The name of the created shortcut icon |
[in] | type | The type of shortcuts |
[in] | uri | The specific information for delivering to the viewer for creating a shortcut |
[in] | icon | The absolute path of an icon file |
[in] | allow_duplicate | 1 if it accepts the duplicated shortcut, otherwise 0 |
[in] | result_cb | The address of the callback function that is called when the result comes back from the viewer |
[in] | data | The callback data that is used in the callback function |
0
on success, otherwise a negative error value SHORTCUT_ERROR_NONE | Successful |
SHORTCUT_ERROR_INVALID_PARAMETER | Invalid parameter |
SHORTCUT_ERROR_OUT_OF_MEMORY | Out of memory |
SHORTCUT_ERROR_IO_ERROR | I/O error |
SHORTCUT_ERROR_PERMISSION_DENIED | Permission denied |
SHORTCUT_ERROR_NOT_SUPPORTED | Not supported |
SHORTCUT_ERROR_RESOURCE_BUSY | Device or resource busy |
SHORTCUT_ERROR_NO_SPACE | No space |
SHORTCUT_ERROR_EXIST | Already exist |
SHORTCUT_ERROR_FAULT | Unrecoverable error |
SHORTCUT_ERROR_COMM | Connection failed |
#include <stdio.h> #include <shortcut_manager.h> static int result_cb(int ret, int pid, void *data) { if (ret < 0) printf("Failed to add a shortcut: %s\n", perror(ret)); printf("Processed by the %d\n", pid); return 0; } static int app_create(void *data) { char* data_path = app_get_data_path(); int path_len = strlen(data_path)+10; char * path = malloc(path_len); memset(path, 0, path_len); strncat(path, data_path, path_len); strncat(path, "Friend.jpg", path_len); shortcut_add_to_home("With friends", LAUNCH_BY_URI, "gallery:0000-0000", path, 0, result_cb, NULL); free(path); return 0; } int main(int argc, char *argv[]) { appcore.... }