Tizen Native API  6.0
Watchface complication provider

All service applications can receive data request from the watch application and sends data to the watchface application using watchface complication provider.

Required Header

#include <watchface-complication-provider.h>

Overview

It provides service that receive requests and sends data to the watch application.

Functions

int watchface_complication_provider_add_update_requested_cb (const char *provider_id, watchface_complication_provider_update_requested_cb callback, void *user_data)
 Adds the callback function to be executed when the update requested.
int watchface_complication_provider_remove_update_requested_cb (const char *provider_id, watchface_complication_provider_update_requested_cb callback)
 Removes a callback function.
int watchface_complication_provider_notify_update (const char *updated_provider_id)
 Notifies to the complication that there is an update.
int watchface_complication_provider_setup_reply_to_editor (app_control_h handle, bundle *context)
 Sends reply to the editor.
int watchface_complication_provider_setup_is_editing (app_control_h handle, bool *is_editing)
 Checks whether watch app request editing or not.
int watchface_complication_provider_setup_get_context (app_control_h handle, bundle **context)
 Gets provider app's setup context data.
int watchface_complication_provider_data_set_short_text (bundle *shared_data, const char *short_text)
 Sets short text data for shared data.
int watchface_complication_provider_data_set_long_text (bundle *shared_data, const char *long_text)
 Sets long text data for shared data.
int watchface_complication_provider_data_set_title (bundle *shared_data, const char *title)
 Sets title data for shared data.
int watchface_complication_provider_data_set_timestamp (bundle *shared_data, long timestamp) TIZEN_DEPRECATED_API
 Sets timestamp data for shared data.
int watchface_complication_provider_timeinfo_create (complication_time_info_h *info)
 Creates timeinfo data.
int watchface_complication_provider_timeinfo_set_timezone (complication_time_info_h info, const char *timezone)
 Sets timezone information.
int watchface_complication_provider_timeinfo_set_timezone_id (complication_time_info_h info, const char *timezone_id)
 Sets timezone id.
int watchface_complication_provider_timeinfo_set_timezone_country (complication_time_info_h info, const char *country)
 Sets timezone country information.
int watchface_complication_provider_timeinfo_set_timezone_city (complication_time_info_h info, const char *city)
 Sets timezone city information.
int watchface_complication_provider_timeinfo_destroy (complication_time_info_h info)
 Destroys timezone handle.
int watchface_complication_provider_data_set_timeinfo (bundle *shared_data, complication_time_info_h info)
 Sets time information data to shared data.
int watchface_complication_provider_data_set_image_path (bundle *shared_data, const char *image_path)
 Sets image path data for shared data.
int watchface_complication_provider_data_set_ranged_value (bundle *shared_data, double current_value, double min_value, double max_value)
 Sets ranged value data for shared data.
int watchface_complication_provider_data_set_icon_path (bundle *shared_data, const char *icon_path)
 Sets icon path data for shared data.
int watchface_complication_provider_data_set_extra_data (bundle *shared_data, const char *extra_data)
 Sets extra data for shared data.
int watchface_complication_provider_data_set_screen_reader_text (bundle *shared_data, const char *screen_reader_text)
 Sets screen reader text for shared data.
int watchface_complication_provider_data_is_valid (bundle *shared_data, bool *is_valid)
 Checks whether shared_data is valid or not.
int watchface_complication_provider_event_get_type (app_control_h handle, watchface_complication_event_type_e *event_type)
 Gets touch event type that is transferred from watchface.
int watchface_complication_provider_event_get_provider_id (app_control_h handle, char **provider_id)
 Gets provider id of touched complication.
int watchface_complication_provider_event_get_complication_type (app_control_h handle, watchface_complication_type_e *type)
 Gets complication type of touched complication.
int watchface_complication_provider_event_get_context (app_control_h handle, bundle **context)
 Gets complication context of touched complication.

Typedefs

typedef void(* watchface_complication_provider_update_requested_cb )(const char *provider_id, const char *req_appid, watchface_complication_type_e type, const bundle *context, bundle *share_data, void *user_data)
 Called when a watchface complication requests data update.

Typedef Documentation

typedef void(* watchface_complication_provider_update_requested_cb)(const char *provider_id, const char *req_appid, watchface_complication_type_e type, const bundle *context, bundle *share_data, void *user_data)

Called when a watchface complication requests data update.

Watchface application which sends an update request will receive share_data through watchface_complication_updated_cb()'s data parameter after this callback is finished.

Since :
5.0
Remarks:
The share_data should not be released.
Parameters:
[in]provider_idThe id of the provider The provider_id can be used only in the callback. To use outside, make a copy.
[in]req_appidThe name of the watchface that update request The req_appid can be used only in the callback. To use outside, make a copy.
[in]typeComplication Type
[in]contextThe data set in the setting app for the provider The context can be used only in the callback. To use outside, make a copy.
[in]share_dataThe data to update. This data will be shared with watchface application. The share_data is managed by the platform and will be released after this callback is finished.
[in]user_dataThe user data passed from the callback function
See also:
watchface_complication_provider_add_update_requested_cb()
watchface_complication_updated_cb()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(
    const char *provider_id, const char *req_appid,
    watchface_complication_type_e type, const bundle *context,
    bundle *shared_data, void *user_data)
{
    char num_str[128] = {0, };
    int num = rand();

    if (type == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT) {
        if (strcmp(provider_id, AIR_POLLUTION_PROVIDER_ID) == 0) {
            snprintf(num_str, sizeof(num_str), "air %d", num % 200);
            watchface_complication_provider_data_set_short_text(
                shared_data, num_str);
        } else if (strcmp(provider_id, BATTERY_PROVIDER_ID) == 0) {
            snprintf(num_str, sizeof(num_str),
                    "battery %d", num % 100);
            watchface_complication_provider_data_set_short_text(
                shared_data, num_str);
        }
    }
}

bool app_create(void *data)
{
    watchface_complication_provider_add_update_requested_cb(
            BATTERY_PROVIDER_ID,
            _watchface_complication_provider_update_requested_cb,
            NULL);
    watchface_complication_provider_add_update_requested_cb(
            AIR_POLLUTION_PROVIDER_ID,
            _watchface_complication_provider_update_requested_cb,
            NULL);
    return true;
}

Function Documentation

int watchface_complication_provider_add_update_requested_cb ( const char *  provider_id,
watchface_complication_provider_update_requested_cb  callback,
void *  user_data 
)

Adds the callback function to be executed when the update requested.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
Remarks:
Since 5.5, http://tizen.org/privilege/datasharing is required.
Parameters:
[in]provider_idThe id of the provider
[in]callbackThe callback function
[in]user_dataThe user data passed from the callback function
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccess
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIEDPermission denied
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
WATCHFACE_COMPLICATION_ERROR_DBDatabase error
See also:
watchface_complication_provider_remove_update_requested_cb()
Sample code:
#include <watchface-complication-provider.h>
{
    watchface_complication_provider_add_update_requested_cb("PROVIDER_ID",
            _watchface_complication_provider_update_requested_cb, NULL);
}
int watchface_complication_provider_data_is_valid ( bundle shared_data,
bool *  is_valid 
)

Checks whether shared_data is valid or not.

Developer can check the shared data is valid. If the following mandatory data is not set in shared_data, it's not valid.
WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT : short text
WATCHFACE_COMPLICATION_TYPE_LONG_TEXT : long text
WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE : current, min, max
WATCHFACE_COMPLICATION_TYPE_TIME : timestamp or timezone_id
WATCHFACE_COMPLICATION_TYPE_ICON : icon path
WATCHFACE_COMPLICATION_TYPE_IMAGE : image path

Since :
5.0
Parameters:
[in]shared_dataThe data which will be shared with watch application
[out]is_validThe value that tell the shared_data is valid or not.
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
See also:
watchface_complication_type_e
watchface_complication_provider_data_set_short_text()
watchface_complication_provider_data_set_long_text()
watchface_complication_provider_data_set_ranged_value()
watchface_complication_provider_data_set_icon_path()
watchface_complication_provider_data_set_image_path()
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_set_timezone_id()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    char num_str[128] = {0, };
    int num = rand();
    bool is_valid;

    if (type == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT) {
        snprintf(num_str, sizeof(num_str), "air %d", num % 200);
        watchface_complication_provider_data_set_short_text(
            shared_data, num_str);

        watchface_complication_provider_data_is_valid(shared_data, &is_valid);
    }
}
int watchface_complication_provider_data_set_extra_data ( bundle shared_data,
const char *  extra_data 
)

Sets extra data for shared data.

Since :
5.0
Remarks:
extra_data can be added to every type of shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]extra_dataThe extra data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    watchface_complication_provider_data_set_extra_data(shared_data, "extra");
}
int watchface_complication_provider_data_set_icon_path ( bundle shared_data,
const char *  icon_path 
)

Sets icon path data for shared data.

Since :
5.0
Remarks:
icon_path can be added only for WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_TIME, WATCHFACE_COMPLICATION_TYPE_ICON type shared data.
icon_path should be relative path like shared/res/icon.png.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]icon_pathThe icon path data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_ICON)
        watchface_complication_provider_data_set_icon_path(shared_data, "path");
}
int watchface_complication_provider_data_set_image_path ( bundle shared_data,
const char *  image_path 
)

Sets image path data for shared data.

Since :
5.0
Remarks:
image_path can be added only for WATCHFACE_COMPLICATION_TYPE_IMAGE type shared data.
image_path should be relative path like shared/res/image.png.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]image_pathThe image path data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_IMAGE)
        watchface_complication_provider_data_set_image_path(shared_data, "path");
}
int watchface_complication_provider_data_set_long_text ( bundle shared_data,
const char *  long_text 
)

Sets long text data for shared data.

Since :
5.0
Remarks:
long_text can be added only for WATCHFACE_COMPLICATION_TYPE_LONG_TEXT type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]long_textThe long text data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_LONG_TEXT)
        watchface_complication_provider_data_set_long_text(shared_data, "long text data");
}
int watchface_complication_provider_data_set_ranged_value ( bundle shared_data,
double  current_value,
double  min_value,
double  max_value 
)

Sets ranged value data for shared data.

Since :
5.0
Remarks:
min_value, max_value, current_value can be added only for WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]current_valueThe current value
[in]min_valueThe minimum value
[in]max_valueThe max value
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE)
        watchface_complication_provider_data_set_ranged_value(shared_data, 50.0, 0.0, 100.0);
}
int watchface_complication_provider_data_set_screen_reader_text ( bundle shared_data,
const char *  screen_reader_text 
)

Sets screen reader text for shared data.

Since :
5.0
Remarks:
screen_reader_text can be added to every type of shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]screen_reader_textThe screen reader text
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    watchface_complication_provider_data_set_screen_reader_text(shared_data, "screen reader text");
}
int watchface_complication_provider_data_set_short_text ( bundle shared_data,
const char *  short_text 
)

Sets short text data for shared data.

Since :
5.0
Remarks:
short_text data can be added only for WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE, WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]short_textThe short text data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT)
        watchface_complication_provider_data_set_short_text(shared_data, "text data");
}

Sets time information data to shared data.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]infoThe time information handle
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_set_timezone()
watchface_complication_provider_timeinfo_set_timezone_id()
watchface_complication_provider_timeinfo_set_timezone_country()
watchface_complication_provider_timeinfo_set_timezone_city()
watchface_complication_provider_timeinfo_destroy()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_set_timezone(info, "UTC+9");
        watchface_complication_provider_data_set_timeinfo(shared_data, info);
        watchface_complication_provider_timeinfo_destroy(info);
    }
}
int watchface_complication_provider_data_set_timestamp ( bundle shared_data,
long  timestamp 
)

Sets timestamp data for shared data.

Deprecated:
Deprecated since 5.5. Use watchface_complication_provider_data_set_timeinfo() instead.
Since :
5.0
Remarks:
timestamp can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]timestampThe timestamp data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    time_t seconds;

    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        seconds = time(NULL);
        watchface_complication_provider_data_set_timestamp(shared_data, seconds);
    }
}
int watchface_complication_provider_data_set_title ( bundle shared_data,
const char *  title 
)

Sets title data for shared data.

Since :
5.0
Remarks:
title can be added only for WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT, WATCHFACE_COMPLICATION_TYPE_LONG_TEXT, WATCHFACE_COMPLICATION_TYPE_RANGED_VALUE type shared data.
Parameters:
[in]shared_dataThe data which will be shared with watch application
[in]titleThe title text data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_type_e
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_SHORT_TEXT)
        watchface_complication_provider_data_set_title(shared_data, "title");
}

Gets complication type of touched complication.

Since :
5.0
Parameters:
[in]handleThe app control handle
[out]typeThe complication type of touched complication
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
WATCHFACE_COMPLICATION_ERROR_NO_DATANo data
See also:
watchface_complication_transfer_event()
watchface_complication_provider_event_get_provider_id()
watchface_complication_provider_event_get_context()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    watchface_complication_event_type_e event_type;
    char *provider_id;
    watchface_complication_type_e type;
    bundle *context

    watchface_complication_provider_event_get_type(app_control, &event_type);
    if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
        watchface_complication_provider_event_get_provider_id(app_control,
            &provider_id);
        watchface_complication_provider_event_get_complication_type(
            app_control, &type);
        watchface_complication_provider_event_get_context(app_control,
            &context);
        // Do something
    }
}

Gets complication context of touched complication.

Since :
5.0
Remarks:
context is customized information about complication setup. complication setup can be generated by complication setup app and complication setup app can be specified with complication provider app's manifest xml file.
The context should be released using bundle_free().
Parameters:
[in]handleThe app control handle
[out]contextThe complication context of touched complication
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
WATCHFACE_COMPLICATION_ERROR_NO_DATANo data
See also:
watchface_complication_transfer_event()
watchface_complication_provider_event_get_provider_id()
watchface_complication_provider_event_get_complication_type()
watchface_complication_provider_setup_reply_to_editor()
watchface_complication_provider_setup_is_editing()
watchface_complication_provider_setup_get_context()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    watchface_complication_event_type_e event_type;
    char *provider_id;
    watchface_complication_type_e type;
    bundle *context

    watchface_complication_provider_event_get_type(app_control, &event_type);
    if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
        watchface_complication_provider_event_get_provider_id(app_control,
            &provider_id);
        watchface_complication_provider_event_get_complication_type(
            app_control, &type);
        watchface_complication_provider_event_get_context(app_control,
            &context);
        // Do something
    }
}
int watchface_complication_provider_event_get_provider_id ( app_control_h  handle,
char **  provider_id 
)

Gets provider id of touched complication.

Since :
5.0
Remarks:
The provider_id should be freed using free().
Parameters:
[in]handleThe app control handle
[out]provider_idThe provider id of touched complication
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
WATCHFACE_COMPLICATION_ERROR_NO_DATANo data
See also:
watchface_complication_transfer_event()
watchface_complication_provider_event_get_complication_type()
watchface_complication_provider_event_get_context()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    watchface_complication_event_type_e event_type;
    char *provider_id;
    watchface_complication_type_e type;
    bundle *context

    watchface_complication_provider_event_get_type(app_control, &event_type);
    if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
        watchface_complication_provider_event_get_provider_id(app_control,
            &provider_id);
        watchface_complication_provider_event_get_complication_type(
            app_control, &type);
        watchface_complication_provider_event_get_context(app_control,
            &context);
        // Do something
    }
}

Gets touch event type that is transferred from watchface.

Since :
5.0
Remarks:
event_type is the type of touch event transftered from the watchface by watchface_complication_transfer_event().
Parameters:
[in]handleThe app control handle
[out]event_typeThe value that tells touch event type that is transferred.
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_event_type_e
watchface_complication_transfer_event()
watchface_complication_provider_event_get_provider_id()
watchface_complication_provider_event_get_complication_type()
watchface_complication_provider_event_get_context()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    watchface_complication_event_type_e event_type;
    char *provider_id;
    watchface_complication_type_e type;
    bundle *context

    watchface_complication_provider_event_get_type(app_control, &event_type);
    if (event_type == WATCHFACE_COMPLICATION_EVENT_TAP) {
        watchface_complication_provider_event_get_provider_id(app_control,
            &provider_id);
        watchface_complication_provider_event_get_complication_type(
            app_control, &type);
        watchface_complication_provider_event_get_context(app_control,
            &context);
        // Do something
    }
}
int watchface_complication_provider_notify_update ( const char *  updated_provider_id)

Notifies to the complication that there is an update.

Complication automatically requests data when notify is received.

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
Parameters:
[in]updated_provider_idThe id of the provider
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccess
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIEDPermission denied
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
Sample code:
#include <watchface-complication-provider.h>
{
    const char *provider_id = "org.tizen.comp_provider/battery";

    watchface_complication_provider_notify_update(provider_id);
}

Removes a callback function.

Since :
5.0
Parameters:
[in]provider_idThe id of the provider
[in]callbackThe callback function
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE if success, other value if failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccess
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
See also:
watchface_complication_provider_add_update_requested_cb()
Sample code:
#include <watchface-complication-provider.h>
{
    watchface_complication_provider_remove_update_requested_cb("PROVIDER_ID",
            _watchface_complication_provider_update_requested_cb);
}

Gets provider app's setup context data.

Context data will be passed to the complication provider application through the app_control event callback's app_control_h handle parameter

Since :
5.0
Remarks:
This function is for complication provider's setup application which specified in provider app's manifest file with setup-appid attribute.
The context should be released using bundle_free().
Parameters:
[in]handleThe editable handle
[out]contextapp's setup context data
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
See also:
complication_provider_setup_reply_to_editor()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    bundle *b;

    watchface_complication_provider_setup_get_context(app_control, &b);
    // Draw complication provider app's current setting state.
}
int watchface_complication_provider_setup_is_editing ( app_control_h  handle,
bool *  is_editing 
)

Checks whether watch app request editing or not.

Using this function, setup app can tell what kind of UI should be displayed

Since :
5.0
Remarks:
This function is for complication provider's setup application which specified in provider app's manifest file with setup-appid attribute.
Parameters:
[in]handleThe editable handle
[out]is_editingThe value that tell it's editing mode.
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
See also:
complication_provider_setup_reply_to_editor()
Sample code:
#include <watchface-complication-provider.h>
void app_control(app_control_h app_control, void *data)
{
    bool is_editing;

    watchface_complication_provider_setup_is_editing(app_control, &is_editing);
    if (is_editing) {
        watchface_complication_provider_setup_get_context(handle, &b);
        // Draw complication provider app's current setting state.
    }
}

Sends reply to the editor.

Using this function, setup app can sends new context data to the editor

Since :
5.0
Privilege Level:
public
Privilege:
http://tizen.org/privilege/datasharing
Remarks:
This function is for complication provider's setup application which specified in provider app's manifest file with setup-appid attribute.
Parameters:
[in]handleThe editable handle
[in]contextThe new context data of complication provider.
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_PERMISSION_DENIEDPermission denied
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
complication_provider_setup_get_context()
Sample code:
#include <watchface-complication-provider.h>

{
    bundle *b = bundle_create();
    bundle_add_str(b, "REGION_DATA", "KR");
    watchface_complication_provider_setup_reply_to_editor(handle, b);
    bundle_free(b);
}

Creates timeinfo data.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
The info should be released using watchface_complication_provider_timeinfo_destroy().
Parameters:
[out]infoThe time information handle
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
See also:
watchface_complication_provider_timeinfo_set_timezone()
watchface_complication_provider_timeinfo_set_timezone_id()
watchface_complication_provider_timeinfo_set_timezone_country()
watchface_complication_provider_timeinfo_set_timezone_city()
watchface_complication_provider_timeinfo_destroy()
watchface_complication_provider_data_set_timeinfo()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_destroy(info);
    }
}

Sets timezone information.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]infoThe time information handle
[in]timezoneThe timezone string
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_set_timezone_id()
watchface_complication_provider_timeinfo_set_timezone_country()
watchface_complication_provider_timeinfo_set_timezone_city()
watchface_complication_provider_timeinfo_destroy()
watchface_complication_provider_data_set_timeinfo()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_set_timezone(info, "UTC+9");
        watchface_complication_provider_timeinfo_destroy(info);
    }
}

Sets timezone city information.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]infoThe time information handle
[in]cityThe timezone city information
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_provider_timeinfo_set_timezone()
watchface_complication_provider_timeinfo_set_timezone_id()
watchface_complication_provider_timeinfo_set_timezone_country()
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_destroy()
watchface_complication_provider_data_set_timeinfo()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_set_timezone_city(info, "Seoul");
        watchface_complication_provider_timeinfo_destroy(info);
    }
}

Sets timezone country information.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]infoThe time information handle
[in]countryThe timezone country information
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_provider_timeinfo_set_timezone()
watchface_complication_provider_timeinfo_set_timezone_id()
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_set_timezone_city()
watchface_complication_provider_timeinfo_destroy()
watchface_complication_provider_data_set_timeinfo()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_set_timezone_country(info, "Korea");
        watchface_complication_provider_timeinfo_destroy(info);
    }
}

Sets timezone id.

Since :
5.5
Remarks:
info can be added only for WATCHFACE_COMPLICATION_TYPE_TIME type shared data.
Parameters:
[in]infoThe time information handle
[in]timezone_idThe timezone id which is specified in TZ database
Returns:
WATCHFACE_COMPLICATION_ERROR_NONE on success, otherwise an error code (see watchface_complication_error_e) on failure
Return values:
WATCHFACE_COMPLICATION_ERROR_NONESuccessful
WATCHFACE_COMPLICATION_ERROR_NOT_SUPPORTEDNot supported
WATCHFACE_COMPLICATION_ERROR_INVALID_PARAMETERInvalid parameter
WATCHFACE_COMPLICATION_ERROR_OUT_OF_MEMORYOut of memory
WATCHFACE_COMPLICATION_ERROR_IO_ERRORI/O error
See also:
watchface_complication_provider_timeinfo_set_timezone()
watchface_complication_provider_timeinfo_create()
watchface_complication_provider_timeinfo_set_timezone_country()
watchface_complication_provider_timeinfo_set_timezone_city()
watchface_complication_provider_timeinfo_destroy()
watchface_complication_provider_data_set_timeinfo()
Sample code:
#include <watchface-complication-provider.h>
void _watchface_complication_provider_update_requested_cb(const char *provider_id,
        const char *req_appid, watchface_complication_type_e type,
        const bundle *context, bundle *shared_data, void *user_data)
{
    if (type == WATCHFACE_COMPLICATION_TYPE_TIME) {
        complication_time_info_h info;
        watchface_complication_provider_timeinfo_create(&info);
        watchface_complication_provider_timeinfo_set_timezone_id(info, "Asia/Seoul");
        watchface_complication_provider_timeinfo_destroy(info);
    }
}