Tizen Native API

Badge APIs.

Required Header

#include <badge.h>

Overview

It provides functions for creating and inserting and updating badge.

Functions

int badge_new (const char *writable_app_id)
 Creates a badge for the application itself.
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.

Typedefs

typedef enum _badge_error_e badge_error_e
 Enumeration for Badge Error.

Enumeration Type Documentation

Enumeration for Badge Error.

Enumerator:
BADGE_ERROR_NONE 

Success

BADGE_ERROR_INVALID_PARAMETER 

Invalid parameter

BADGE_ERROR_OUT_OF_MEMORY 

Out of memory

BADGE_ERROR_PERMISSION_DENIED 

Permission denied

BADGE_ERROR_IO_ERROR 

Error from I/O

BADGE_ERROR_FROM_DB 

Error from DB

BADGE_ERROR_ALREADY_EXIST 

Already exist

BADGE_ERROR_FROM_DBUS 

Error from DBus

BADGE_ERROR_NOT_EXIST 

Not exist

BADGE_ERROR_SERVICE_NOT_READY 

Error service not ready


Function Documentation

int badge_get_count ( const char *  app_id,
unsigned int *  count 
)

Gets badge count for the designated application.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification
Parameters:
[in]app_idThe name of the designated application
[out]countThe count of the badge
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_FROM_DBError from DB
BADGE_ERROR_ALREADY_EXISTAlready exist
BADGE_ERROR_OUT_OF_MEMORYOut of memory
See also:
badge_error_e
badge_new()
badge_set_count()
Sample code:
#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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification
Parameters:
[in]app_idThe name of the designated application
[out]is_displayThe display option (1 = display, 0 = not display)
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_FROM_DBError from DB
BADGE_ERROR_NOT_EXISTNot exist
BADGE_ERROR_SERVICE_NOT_READYService is not ready
BADGE_ERROR_OUT_OF_MEMORYOut of memory
See also:
badge_error_e
badge_new()
badge_set_count()
Sample code:
#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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification

Creates new badge to display.

Parameters:
[in]writable_app_idThe id of application which is authorized to change the badge
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_IO_ERRORError from I/O
BADGE_ERROR_SERVICE_NOT_READYService is not ready
See also:
badge_error_e
Sample code:
#include <badge.h>
...
{
    int err = BADGE_ERROR_NONE;

    err = badge_new(app_id);
    if(err != BADGE_ERROR_NONE) {
        return;
    }

}
int badge_remove ( const char *  app_id)

Removes the badge for the designated application.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification
Parameters:
[in]app_idThe name of the designated application
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_IO_ERRORError from I/O
BADGE_ERROR_SERVICE_NOT_READYService is not ready
See also:
badge_error_e
Sample code:
#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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification
Parameters:
[in]app_idThe name of the designated application
[in]countThe count of the badge
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_IO_ERRORError from I/O
BADGE_ERROR_SERVICE_NOT_READYService is not ready
See also:
badge_error_e
badge_new()
Sample code:
#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.

Since :
2.3.1
Privilege Level:
public
Privilege:
http://tizen.org/privilege/notification
Parameters:
[in]app_idThe name of the designated application
[in]is_displayThe display option (1 = display, 0 = not display)
Returns:
BADGE_ERROR_NONE if success, other value if failure
Return values:
BADGE_ERROR_NONESuccess
BADGE_ERROR_INVALID_PARAMETERInvalid parameter
BADGE_ERROR_PERMISSION_DENIEDThe application does not have the privilege to call this method
BADGE_ERROR_IO_ERRORError from I/O
BADGE_ERROR_SERVICE_NOT_READYService is not ready
See also:
badge_error_e
badge_new()
Sample code:
#include <badge.h>
...
{
    int err = BADGE_ERROR_NONE;

    err = badge_set_display(app_id, 1);
    if(err != BADGE_ERROR_NONE) {
        return;
    }

}