Android.Content.AbstractThreadedSyncAdapter Class
An abstract implementation of a SyncAdapter that spawns a thread to invoke a sync operation.

See Also: AbstractThreadedSyncAdapter Members

Syntax

[Android.Runtime.Register("android/content/AbstractThreadedSyncAdapter", DoNotGenerateAcw=true)]
public abstract class AbstractThreadedSyncAdapter : Java.Lang.Object

Remarks

An abstract implementation of a SyncAdapter that spawns a thread to invoke a sync operation. If a sync operation is already in progress when a startSync() request is received then an error will be returned to the new request and the existing request will be allowed to continue. When a startSync() is received and there is no sync operation in progress then a thread will be started to run the operation and AbstractThreadedSyncAdapter.OnPerformSync(Android.Accounts.Account, Android.OS.Bundle, Android.OS.Bundle, Android.OS.Bundle, Android.OS.Bundle) will be invoked on that thread. If a cancelSync() is received that matches an existing sync operation then the thread that is running that sync operation will be interrupted, which will indicate to the thread that the sync has been canceled.

In order to be a sync adapter one must extend this class, provide implementations for the abstract methods and write a service that returns the result of AbstractThreadedSyncAdapter.SyncAdapterBinder in the service's Android.App.Service.OnBind(Intent) when invoked with an intent with action android.content.SyncAdapter. This service must specify the following intent filter and metadata tags in its AndroidManifest.xml file

xml Example

   <intent-filter>
     <action android:name="android.content.SyncAdapter" />
   </intent-filter>
   <meta-data android:name="android.content.SyncAdapter"
             android:resource="@xml/syncadapter" />
 
The android:resource attribute must point to a resource that looks like:

xml Example

 <sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
    android:contentAuthority="authority"
    android:accountType="accountType"
    android:userVisible="true|false"
    android:supportsUploading="true|false"
    android:allowParallelSyncs="true|false"
    android:isAlwaysSyncable="true|false"
    android:syncAdapterSettingsAction="ACTION_OF_SETTINGS_ACTIVITY"
 />
 

[Android Documentation]

Requirements

Namespace: Android.Content
Assembly: Mono.Android (in Mono.Android.dll)
Assembly Versions: 0.0.0.0
Since: Added in API level 5