Tizen Native API
5.0
|
Badge APIs.
#include <badge.h>
It provides functions for creating and inserting and updating badge.
This API is related with the following features:
Functions | |
int | badge_new (const char *writable_app_id) TIZEN_DEPRECATED_API |
Creates a badge for the application itself. | |
int | badge_add (const char *badge_app_id) |
Creates a badge for the application specified by the badge_app_id. | |
int | badge_remove (const char *app_id) |
Removes the badge for the designated application. | |
int | badge_set_count (const char *app_id, unsigned int count) |
Sets badge count for the designated application. | |
int | badge_get_count (const char *app_id, unsigned int *count) |
Gets badge count for the designated application. | |
int | badge_set_display (const char *app_id, unsigned int is_display) |
Sets the display option for the designated application. | |
int | badge_get_display (const char *app_id, unsigned int *is_display) |
Gets the display option for the designated application. | |
int | badge_foreach (badge_foreach_cb callback, void *user_data) |
Retrieves all existing badges. | |
int | badge_register_changed_cb (badge_change_cb callback, void *user_data) |
Registers a callback function to receive badge change event. | |
int | badge_unregister_changed_cb (badge_change_cb callback) |
Unregisters a callback function to receive badge change event. | |
Typedefs | |
typedef bool(* | badge_foreach_cb )(const char *app_id, unsigned int count, void *user_data) |
Callback function for getting result of badge_foreach. | |
typedef void(* | badge_change_cb )(unsigned int action, const char *app_id, unsigned int count, void *user_data) |
Called when the badge information is changed. | |
typedef enum _badge_error_e | badge_error_e |
Enumeration for Badge Error. |
typedef void(* badge_change_cb)(unsigned int action, const char *app_id, unsigned int count, void *user_data) |
Called when the badge information is changed.
[in] | action | The type of the change. Refer badge_action |
[in] | app_id | The name of the application |
[in] | count | The count of the badge |
[in] | user_data | The user data passed from the callback register function |
typedef enum _badge_error_e badge_error_e |
Enumeration for Badge Error.
typedef bool(* badge_foreach_cb)(const char *app_id, unsigned int count, void *user_data) |
Callback function for getting result of badge_foreach.
[in] | app_id | The id of the application |
[in] | count | The count of the badge |
[in] | user_data | The user data passed from the badge_foreach function |
enum _badge_error_e |
Enumeration for Badge Error.
enum badge_action |
int badge_add | ( | const char * | badge_app_id | ) |
Creates a badge for the application specified by the badge_app_id.
[in] | badge_app_id | The id of the application for which the badge will be created. This parameter can be null when creating a badge for itself. |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_ALREADY_EXIST | Already exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_INVALID_PACKAGE | The caller application is not signed with the certificate of the badge_app_id |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; err = badge_add("org.tizen.email"); if (err != BADGE_ERROR_NONE) return; }
int badge_foreach | ( | badge_foreach_cb | callback, |
void * | user_data | ||
) |
Retrieves all existing badges.
[in] | callback | The callback function |
[in] | user_data | The user data to be passed to the callback function |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error form DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
int badge_get_count | ( | const char * | app_id, |
unsigned int * | count | ||
) |
Gets badge count for the designated application.
[in] | app_id | The name of the designated application |
[out] | count | The count of the badge |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; int count = 0; err = badge_get_count(app_id, &count); if (err != BADGE_ERROR_NONE) return; }
int badge_get_display | ( | const char * | app_id, |
unsigned int * | is_display | ||
) |
Gets the display option for the designated application.
[in] | app_id | The name of the designated application |
[out] | is_display | The display option (1 = display, 0 = not display) |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int is_display = 0; int err = BADGE_ERROR_NONE; err = badge_get_display(app_id, &is_display); if (err != BADGE_ERROR_NONE) return; }
int badge_new | ( | const char * | writable_app_id | ) |
Creates a badge for the application itself.
Creates new badge to display.
[in] | writable_app_id | The id of application which is authorized to change the badge |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; err = badge_new(app_id); if (err != BADGE_ERROR_NONE) return; }
int badge_register_changed_cb | ( | badge_change_cb | callback, |
void * | user_data | ||
) |
Registers a callback function to receive badge change event.
[in] | callback | The callback function |
[in] | user_data | The user data to be passed to the callback function |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
int badge_remove | ( | const char * | app_id | ) |
Removes the badge for the designated application.
[in] | app_id | The name of the designated application |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; err = badge_remove(app_id); if (err != BADGE_ERROR_NONE) return; }
int badge_set_count | ( | const char * | app_id, |
unsigned int | count | ||
) |
Sets badge count for the designated application.
[in] | app_id | The name of the designated application |
[in] | count | The count of the badge |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; err = badge_set_count(app_id, 1); if (err != BADGE_ERROR_NONE) return; }
int badge_set_display | ( | const char * | app_id, |
unsigned int | is_display | ||
) |
Sets the display option for the designated application.
[in] | app_id | The name of the designated application |
[in] | is_display | The display option (1 = display, 0 = not display) |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_OUT_OF_MEMORY | Out of memory |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_IO_ERROR | Error from I/O |
BADGE_ERROR_FROM_DB | Error from DB |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_SERVICE_NOT_READY | Service is not ready |
BADGE_ERROR_NOT_SUPPORTED | Not supported |
#include <badge.h> { int err = BADGE_ERROR_NONE; err = badge_set_display(app_id, 1); if (err != BADGE_ERROR_NONE) return; }
int badge_unregister_changed_cb | ( | badge_change_cb | callback | ) |
Unregisters a callback function to receive badge change event.
[in] | callback | The callback function |
BADGE_ERROR_NONE | Success |
BADGE_ERROR_INVALID_PARAMETER | Invalid parameter |
BADGE_ERROR_PERMISSION_DENIED | The application does not have the privilege to call this method |
BADGE_ERROR_NOT_EXIST | Not exist |
BADGE_ERROR_NOT_SUPPORTED | Not supported |