Android.Accounts.AbstractAccountAuthenticator Class
Abstract base class for creating AccountAuthenticators.

See Also: AbstractAccountAuthenticator Members

Syntax

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

Remarks

Abstract base class for creating AccountAuthenticators. In order to be an authenticator one must extend this class, provider implementations for the abstract methods and write a service that returns the result of AbstractAccountAuthenticator.IBinder in the service's Android.App.Service.OnBind(Android.Content.Intent) when invoked with an intent with action AccountManager.ActionAuthenticatorIntent. This service must specify the following intent filter and metadata tags in its AndroidManifest.xml file

xml Example

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

xml Example

 <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="typeOfAuthenticator"
    android:icon="@drawable/icon"
    android:smallIcon="@drawable/miniIcon"
    android:label="@string/label"
    android:accountPreferences="@xml/account_preferences"
 />
 
Replace the icons and labels with your own resources. The android:accountType attribute must be a string that uniquely identifies your authenticator and will be the same string that user will use when making calls on the Android.Accounts.AccountManager and it also corresponds to Account.Type for your accounts. One user of the android:icon is the "Account & Sync" settings page and one user of the android:smallIcon is the Contact Application's tab panels.

The preferences attribute points to a PreferenceScreen xml hierarchy that contains a list of PreferenceScreens that can be invoked to manage the authenticator. An example is:

xml Example

 <PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
    <PreferenceCategory android:title="@string/title_fmt" />
    <PreferenceScreen
         android:key="key1"
         android:title="@string/key1_action"
         android:summary="@string/key1_summary">
         <intent
             android:action="key1.ACTION"
             android:targetPackage="key1.package"
             android:targetClass="key1.class" />
     </PreferenceScreen>
 </PreferenceScreen>
 

The standard pattern for implementing any of the abstract methods is the following:

The following descriptions of each of the abstract authenticator methods will not describe the possible asynchronous nature of the request handling and will instead just describe the input parameters and the expected result.

When writing an activity to satisfy these requests one must pass in the AccountManagerResponse and return the result via that response when the activity finishes (or whenever else the activity author deems it is the correct time to respond). The Android.Accounts.AccountAuthenticatorActivity handles this, so one may wish to extend that when writing activities to handle these requests.

[Android Documentation]

Requirements

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