1<p>This sample demonstrates how an application can communicate with a
2cloud-based service and synchronize its data with data stored locally in a
3content provider. The sample uses two related parts of the Android framework
4&mdash; the account manager and the synchronization manager (through a sync
5adapter). It also demonstrates how to provide users the ability to create
6and edit synchronized contacts using a custom editor.</p>
7
8<p> The <a
9href="../../../reference/android/accounts/AccountManager.html">account
10manager</a> allows sharing of credentials across multiple applications and
11services. Users enter the credentials for each account only once &mdash;
12applications with the <code>USE_CREDENTIALS</code> permission can then query the
13account manager to obtain an auth token for the account. An authenticator (a
14pluggable component of account manager) requests credentials from the user,
15validates them with an authentication server running in the cloud, and then
16stores them to the account manager. This sample demonstrates how to write an
17authenticator for your service by extending the new  <code><a
18href="../../../reference/android/accounts/AbstractAccountAuthenticator.html">
19AbstractAccountAuthenticator</a></code> abstract class. </p>
20
21<p>The sync adapter (essential to the synchronization service) declares the
22account type and ContentProvider authority to the sync manager. This sample
23demosntrates how to write your own sync adapters by extending the <code><a
24href="../../../reference/android/content/AbstractThreadedSyncAdapter.html">
25AbstractThreadedSyncAdapter</a></code> abstract class and implementing the
26<code>onPerformSync()</code> method, which gets called whenever the sync manager
27issues a sync operation for that sync adapter. </p>
28
29<p class="note"><strong>Update:</strong> This sample has been updated for Android 4.0 to
30demonstrate new features, including: syncing and viewing contact groups, handling the "invite"
31intent, and a few other improvements.</p>
32
33<p> The cloud-based service for this sample application is running at: </p>
34<p style="margin-left:2em;">http://samplesyncadapter2.appspot.com/</p>
35
36<p>When you install this sample application, a new syncable "SampleSyncAdapter"
37account will be added to your phone's account manager. You can go to "Settings |
38Accounts &amp; Sync" to view the account and change its sync settings. </p>
39
40<img alt="Screenshot 1" src="../images/SampleSyncAdapter1.png" />
41<img alt="Screenshot 2" src="../images/SampleSyncAdapter2.png" />
42<img alt="Screenshot 3" src="../images/SampleSyncAdapter3.png" />
43