다음을 통해 공유


AbstractAccountAuthenticator Class

Definition

Abstract base class for creating AccountAuthenticators.

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

Remarks

Abstract base class for creating AccountAuthenticators. In order to be an authenticator one must extend this class, provide implementations for the abstract methods, and write a service that returns the result of #getIBinder() in the service's android.app.Service#onBind(android.content.Intent) when invoked with an intent with action AccountManager#ACTION_AUTHENTICATOR_INTENT. This service must specify the following intent filter and metadata tags in its AndroidManifest.xml file

&lt;intent-filter&gt;
                &lt;action android:name="android.accounts.AccountAuthenticator" /&gt;
              &lt;/intent-filter&gt;
              &lt;meta-data android:name="android.accounts.AccountAuthenticator"
                        android:resource="@xml/authenticator" /&gt;

The android:resource attribute must point to a resource that looks like:

&lt;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"
            /&gt;

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 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:

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

The standard pattern for implementing any of the abstract methods is the following: <ul> <li> If the supplied arguments are enough for the authenticator to fully satisfy the request then it will do so and return a Bundle that contains the results. <li> If the authenticator needs information from the user to satisfy the request then it will create an Intent to an activity that will prompt the user for the information and then carry out the request. This intent must be returned in a Bundle as key AccountManager#KEY_INTENT.

The activity needs to return the final result when it is complete so the Intent should contain the AccountAuthenticatorResponse as AccountManager#KEY_ACCOUNT_AUTHENTICATOR_RESPONSE. The activity must then call AccountAuthenticatorResponse#onResult or AccountAuthenticatorResponse#onError when it is complete. <li> If the authenticator cannot synchronously process the request and return a result then it may choose to return null and then use the AccountManagerResponse to send the result when it has completed the request. This asynchronous option is not available for the #addAccount method, which must complete synchronously. </ul>

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).

Java documentation for android.accounts.AbstractAccountAuthenticator.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Constructors

AbstractAccountAuthenticator(Context)
AbstractAccountAuthenticator(IntPtr, JniHandleOwnership)

A constructor used when creating managed representations of JNI objects; called by the runtime.

Fields

KeyCustomTokenExpiry

Bundle key used for the long expiration time (in millis from the unix epoch) of the associated auth token.

Properties

Class

Returns the runtime class of this Object.

(Inherited from Object)
Handle

The handle to the underlying Android instance.

(Inherited from Object)
IBinder
JniIdentityHashCode (Inherited from Object)
JniPeerMembers
PeerReference (Inherited from Object)
ThresholdClass

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

ThresholdType

This API supports the Mono for Android infrastructure and is not intended to be used directly from your code.

Methods

AddAccount(AccountAuthenticatorResponse, String, String, String[], Bundle)

Adds an account of the specified accountType.

AddAccountFromCredentials(AccountAuthenticatorResponse, Account, Bundle)

Creates an account based on credentials provided by the authenticator instance of another user on the device, who has chosen to share the account with this user.

Clone()

Creates and returns a copy of this object.

(Inherited from Object)
ConfirmCredentials(AccountAuthenticatorResponse, Account, Bundle)

Checks that the user knows the credentials of an account.

Dispose() (Inherited from Object)
Dispose(Boolean) (Inherited from Object)
EditProperties(AccountAuthenticatorResponse, String)

Returns a Bundle that contains the Intent of the activity that can be used to edit the properties.

Equals(Object)

Indicates whether some other object is "equal to" this one.

(Inherited from Object)
FinishSession(AccountAuthenticatorResponse, String, Bundle)

Finishes the session started by #startAddAccountSession or #startUpdateCredentials by installing the account to device with AccountManager, or updating the local credentials.

GetAccountCredentialsForCloning(AccountAuthenticatorResponse, Account)

Returns a Bundle that contains whatever is required to clone the account on a different user.

GetAccountRemovalAllowed(AccountAuthenticatorResponse, Account)

Checks if the removal of this account is allowed.

GetAuthToken(AccountAuthenticatorResponse, Account, String, Bundle)

Gets an authtoken for an account.

GetAuthTokenLabel(String)

Ask the authenticator for a localized label for the given authTokenType.

GetHashCode()

Returns a hash code value for the object.

(Inherited from Object)
HasFeatures(AccountAuthenticatorResponse, Account, String[])

Checks if the account supports all the specified authenticator specific features.

IsCredentialsUpdateSuggested(AccountAuthenticatorResponse, Account, String)

Checks if update of the account credentials is suggested.

JavaFinalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

(Inherited from Object)
Notify()

Wakes up a single thread that is waiting on this object's monitor.

(Inherited from Object)
NotifyAll()

Wakes up all threads that are waiting on this object's monitor.

(Inherited from Object)
SetHandle(IntPtr, JniHandleOwnership)

Sets the Handle property.

(Inherited from Object)
StartAddAccountSession(AccountAuthenticatorResponse, String, String, String[], Bundle)

Starts the add account session to authenticate user to an account of the specified accountType.

StartUpdateCredentialsSession(AccountAuthenticatorResponse, Account, String, Bundle)

Asks user to re-authenticate for an account but defers updating the locally stored credentials.

ToArray<T>() (Inherited from Object)
ToString()

Returns a string representation of the object.

(Inherited from Object)
UnregisterFromRuntime() (Inherited from Object)
UpdateCredentials(AccountAuthenticatorResponse, Account, String, Bundle)

Update the locally stored credentials for an account.

Wait()

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>.

(Inherited from Object)
Wait(Int64, Int32)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)
Wait(Int64)

Causes the current thread to wait until it is awakened, typically by being <em>notified</em> or <em>interrupted</em>, or until a certain amount of real time has elapsed.

(Inherited from Object)

Explicit Interface Implementations

IJavaPeerable.Disposed() (Inherited from Object)
IJavaPeerable.DisposeUnlessReferenced() (Inherited from Object)
IJavaPeerable.Finalized() (Inherited from Object)
IJavaPeerable.JniManagedPeerState (Inherited from Object)
IJavaPeerable.SetJniIdentityHashCode(Int32) (Inherited from Object)
IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) (Inherited from Object)
IJavaPeerable.SetPeerReference(JniObjectReference) (Inherited from Object)

Extension Methods

JavaCast<TResult>(IJavaObject)

Performs an Android runtime-checked type conversion.

JavaCast<TResult>(IJavaObject)
GetJniTypeName(IJavaPeerable)

Applies to