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— the account manager and the synchronization manager (through a sync 5adapter).</p> 6 7<p> The <a 8href="../../../reference/android/accounts/AccountManager.html">account 9manager</a> allows sharing of credentials across multiple applications and 10services. Users enter the credentials for each account only once — 11applications with the <code>USE_CREDENTIALS</code> permission can then query the 12account manager to obtain an auth token for the account. An authenticator (a 13pluggable component of account manager) requests credentials from the user, 14validates them with an authentication server running in the cloud, and then 15stores them to the account manager. This sample demonstrates how to write an 16authenticator for your service by extending the new <code><a 17href="../../../reference/android/accounts/AbstractAccountAuthenticator.html"> 18AbstractAccountAuthenticator</a></code> abstract class. </p> 19 20<p>The sync adapter (essential to the synchronization service) declares the 21account type and ContentProvider authority to the sync manager. This sample 22demosntrates how to write your own sync adapters by extending the <code><a 23href="../../../reference/android/content/AbstractThreadedSyncAdapter.html"> 24AbstractThreadedSyncAdapter</a></code> abstract class and implementing the 25<code>onPerformSync()</code> method, which gets called whenever the sync manager 26issues a sync operation for that sync adapter. </p> 27 28<p> The cloud-based service for this sample application is running at: </p> 29<p style="margin-left:2em;">http://samplesyncadapter.appspot.com/users</p> 30 31<p>When you install this sample application, a new syncable "SampleSyncAdapter" 32account will be added to your phone's account manager. You can go to "Settings | 33Accounts & Sync" to view the account and change its sync settings. </p> 34 35<img alt="Screenshot 1" src="../images/SampleSyncAdapter1.png" /> 36<img alt="Screenshot 2" src="../images/SampleSyncAdapter2.png" /> 37<img alt="Screenshot 3" src="../images/SampleSyncAdapter3.png" /> 38