Wednesday, 20 February 2013

Sample Sync Adapter description

fetchFriendUpdates()
1) SyncAdapter.onPerformSync()
2) NetworkUtility.fetchFriendUpdates()
-> this method is return the user list, which is store in ur server, and this method is post the username and password and get the user data.
3) ContactManager.syncContacts()
-> this method is syncronize ur raw  contact.
-> call to ContactManager.lookupRawContact(), return the raw contact Id if foundelse retunr 0.
-> Then check the rawcontact id, and decide to contact is add, delete or update.
-> here we go with exiting contact so, go with the update contact.
-> call to ContactManager.updateContact() for updating the exiting contact.
-> in this method (ContactManager.updateContact()) this method is define the Cursor.query for getting the exiting contact.
-> then get the detail of contact and call to method for update of this detail, like ContactOperation.updateName(),ContactOperation.updatePhone,
 ContactOperation.updateEmail, then adding detail which is present but not in the contact.
-> then call to the BatchOperation.add(), for adding the operation, which will perform in future.
-> then call to the BatchOperation.execute() for executing the save operation.


fetchFriendStatuses()
1) SyncAdapter.onPerformSync()
2) NetworkUtility.fetchFriendStatuses()
-> this method is return the user.statuse list, which is store in ur server, and this method is post the username and password and get the user.statuse data.
3) ContactManager.insertStatuses()
-> this method is add the status to contact provider.
-> this method call to the ContactManager.lookupProfile(), this method is return the profileID.
-> then profile_id >0 then adding the statuse by use od StatusUpdates class.
-> then call to the BatchOperation.add(), for adding the operation, which will perform in future.
-> then call to the BatchOperation.execute() for executing the save operation.