Tizen Native API  4.0

The Sync Adapter.

Required Header

#include <sync_adapter.h>

Overview

Sync Adapter contains the callbacks required sync manager for triggering sync operations. Applications have to implement this sync adapter callback functions. The callback functions holds the logic of data sync operations. Each service application operates sync job respectively through the app control mechanism. The app control is operated by using appId. Also, it can distinguish start or cancel sync operation through app control operations which are written in Sync programming guide.

Functions

int sync_adapter_set_callbacks (sync_adapter_start_sync_cb on_start_cb, sync_adapter_cancel_sync_cb on_cancel_cb)
 Sets client (Sync Adapter) callback functions.
int sync_adapter_unset_callbacks (void)
 Unsets client (Sync Adapter) callback functions.

Typedefs

typedef bool(* sync_adapter_start_sync_cb )(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data)
 Callback function for Sync Adapter's start sync request.
typedef void(* sync_adapter_cancel_sync_cb )(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data)
 Callback function for Sync Adapter's cancel sync request.

Typedef Documentation

typedef void(* sync_adapter_cancel_sync_cb)(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data)

Callback function for Sync Adapter's cancel sync request.

Since :
3.0
Remarks:
This API only can be called at a service application after calling sync_manager_remove_sync_job().

Release account with account_destroy() after using it.

Release sync_job_user_data with bundle_free() after using it.
Parameters:
[in]accountAn account handle on which sync operation was requested or NULL in the case of accountless sync operation
[in]sync_job_nameA string representing a sync job which has been operated or NULL in the case of data change sync operation
[in]sync_capabilityA string representing a sync job which has been operated because of data change or NULL in the case of on demand and periodic sync operation
[in]sync_job_user_dataUser data which contains additional information related registered sync job
Precondition:
The callback must be set by using sync_adapter_set_callbacks().
sync_manager_remove_sync_job() calls this callback in the case there is removable sync job.
See also:
sync_adapter_set_callbacks()
sync_manager_remove_sync_job()
typedef bool(* sync_adapter_start_sync_cb)(account_h account, const char *sync_job_name, const char *sync_capability, bundle *sync_job_user_data)

Callback function for Sync Adapter's start sync request.

Since :
3.0
Remarks:
This API only can be called at a service application.

Release account with account_destroy() after using it.

Release sync_job_user_data with bundle_free() after using it.
Parameters:
[in]accountAn account handle on which sync operation was requested or NULL in the case of accountless sync operation
[in]sync_job_nameA string representing a sync job which has been operated or NULL in the case of data change sync operation
[in]sync_capabilityA string representing a sync job which has been operated because of data change or NULL in the case of on demand or periodic sync operation
[in]sync_job_user_dataUser data which contains additional information related registered sync job
Returns:
true if sync operation is success, false otherwise
Precondition:
The callback must be set by using sync_adapter_set_callbacks().
sync_manager_on_demand_sync_job() calls this callback.
sync_manager_add_periodic_sync_job() calls this callback.
sync_manager_add_data_change_sync_job() calls this callback.
See also:
sync_adapter_set_callbacks()
sync_manager_on_demand_sync_job()
sync_manager_add_periodic_sync_job()
sync_manager_add_data_change_sync_job()

Function Documentation

Sets client (Sync Adapter) callback functions.

Since :
3.0
Remarks:
This API only can be called by a service application. And it can be set by only one service application per a package.
Parameters:
[in]on_start_cbA callback function to be called by Sync Manager for performing sync operation
[in]on_cancel_cbA callback function to be called by Sync Manager for cancelling sync operation
Returns:
0 on success, otherwise a negative error value
Return values:
SYNC_ERROR_NONESuccessful
SYNC_ERROR_NOT_SUPPORTEDNot supported
SYNC_ERROR_OUT_OF_MEMORYOut of memory
SYNC_ERROR_IO_ERRORI/O error
SYNC_ERROR_INVALID_PARAMETERInvalid parameter
SYNC_ERROR_QUOTA_EXCEEDEDQuota exceeded
SYNC_ERROR_SYSTEMSystem error
See also:
sync_adapter_start_sync_cb()
sync_adapter_cancel_sync_cb()
sync_adapter_unset_callbacks()

Unsets client (Sync Adapter) callback functions.

Since :
3.0
Returns:
0 on success, otherwise a negative error value
Return values:
SYNC_ERROR_NONESuccessful
SYNC_ERROR_NOT_SUPPORTEDNot supported
SYNC_ERROR_SYSTEMSystem error
Precondition:
Call sync_adapter_set_callbacks() before calling this function.
See also:
sync_adapter_start_sync_cb()
sync_adapter_cancel_sync_cb()
sync_adapter_set_callbacks()