This sample demonstrates how an application can communicate with a cloud-based service and synchronize its data with data stored locally in a content provider. The sample uses two related parts of the Android framework — the account manager and the synchronization manager (through a sync adapter). It also demonstrates how to provide users the ability to create and edit synchronized contacts using a custom editor.

The account manager allows sharing of credentials across multiple applications and services. Users enter the credentials for each account only once — applications with the `USE_CREDENTIALS` permission can then query the account manager to obtain an auth token for the account. An authenticator (a pluggable component of account manager) requests credentials from the user, validates them with an authentication server running in the cloud, and then stores them to the account manager. This sample demonstrates how to write an authenticator for your service by extending the new `AbstractAccountAuthenticator` abstract class.

The sync adapter (essential to the synchronization service) declares the account type and ContentProvider authority to the sync manager. This sample demosntrates how to write your own sync adapters by extending the `AbstractThreadedSyncAdapter` abstract class and implementing the `onPerformSync()` method, which gets called whenever the sync manager issues a sync operation for that sync adapter.

Update: This sample has been updated for Android 4.0 to demonstrate new features, including: syncing and viewing contact groups, handling the "invite" intent, and a few other improvements.

The cloud-based service for this sample application is running at:

http://samplesyncadapter2.appspot.com/

When you install this sample application, a new syncable "SampleSyncAdapter" account will be added to your phone's account manager. You can go to "Settings | Accounts & Sync" to view the account and change its sync settings.