com.vodafone360.people.service
Class SyncAdapter

java.lang.Object
  extended by AbstractThreadedSyncAdapter
      extended by com.vodafone360.people.service.SyncAdapter
All Implemented Interfaces:
ContactSyncEngine.IContactSyncObserver

public class SyncAdapter
extends AbstractThreadedSyncAdapter
implements ContactSyncEngine.IContactSyncObserver

SyncAdapter implementation which basically just ties in with the old Contacts Sync Engine code for the moment and waits for the sync to be finished. In the future we may want to improve this, particularly if the sync is actually be done in this thread which would also enable disable sync altogether.


Constructor Summary
SyncAdapter(Context context, boolean autoInitialize)
           
 
Method Summary
 void onContactSyncStateChange(ContactSyncEngine.Mode mode, ContactSyncEngine.State oldState, ContactSyncEngine.State newState)
          Called when the contact sync engine changes state or mode
 void onPerformSync(Account account, Bundle extras, java.lang.String authority, ContentProviderClient provider, SyncResult syncResult)
          
 void onProgressEvent(ContactSyncEngine.State currentState, int percent)
          Called to update interested parties on contact sync progress.
 void onSyncComplete(ServiceStatus status)
          Called a contact sync finishes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

SyncAdapter

public SyncAdapter(Context context,
                   boolean autoInitialize)
Method Detail

onPerformSync

public void onPerformSync(Account account,
                          Bundle extras,
                          java.lang.String authority,
                          ContentProviderClient provider,
                          SyncResult syncResult)


onContactSyncStateChange

public void onContactSyncStateChange(ContactSyncEngine.Mode mode,
                                     ContactSyncEngine.State oldState,
                                     ContactSyncEngine.State newState)
Description copied from interface: ContactSyncEngine.IContactSyncObserver
Called when the contact sync engine changes state or mode

Specified by:
onContactSyncStateChange in interface ContactSyncEngine.IContactSyncObserver
Parameters:
mode - Current mode
oldState - Previous state
newState - New state
See Also:
IContactSyncObserver#onContactSyncStateChange(Mode, State, State)

onProgressEvent

public void onProgressEvent(ContactSyncEngine.State currentState,
                            int percent)
Description copied from interface: ContactSyncEngine.IContactSyncObserver
Called to update interested parties on contact sync progress. This is made up of two parts the state and the percentage. Each time the state changes the percentage value will go back to 0.

Specified by:
onProgressEvent in interface ContactSyncEngine.IContactSyncObserver
Parameters:
currentState - What the contact sync engine is currently doing
percent - Percentage complete for the current task
See Also:
IContactSyncObserver#onProgressEvent(State, int)

onSyncComplete

public void onSyncComplete(ServiceStatus status)
Description copied from interface: ContactSyncEngine.IContactSyncObserver
Called a contact sync finishes.

Specified by:
onSyncComplete in interface ContactSyncEngine.IContactSyncObserver
Parameters:
status - SUCCESS if the sync was successful, a suitable error code otherwise.
See Also:
ContactSyncEngine.IContactSyncObserver.onSyncComplete(ServiceStatus)


JavaDoc