Android帐户验证器:在首选项屏幕中区分帐户

Android帐户验证器:在首选项屏幕中区分帐户,android,authentication,account,Android,Authentication,Account,My account authenticator的工作方式就像一个符咒,它的xml看起来或多或少是这样的: <account-authenticator xmlns:android="http://schemas.android.com/apk/res/android" android:accountType="lorenzoff_account" android:icon="@drawable/nice_icon" android:smallIcon="@draw

My account authenticator的工作方式就像一个符咒,它的xml看起来或多或少是这样的:

<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="lorenzoff_account"
    android:icon="@drawable/nice_icon"
    android:smallIcon="@drawable/nice_icon"
    android:label="@string/app_name" 
    android:accountPreferences="@xml/account_preferences" />
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
   <PreferenceCategory android:title="@string/title_fmt" />
   <PreferenceScreen
        android:key="key1"
        android:title="click me"
        android:summary="dont be afraid, click!">
        <intent
            android:action="com.lorenzoff.authenticator.ACTION_UNKNOWN"
            android:targetPackage="key1.package"
            android:targetClass="key1.class" />
    </PreferenceScreen>
</PreferenceScreen>

通过该验证器可以管理多个帐户,假设帐户A、帐户B。 定义两个帐户后,访问帐户和同步设置并单击其中一个打开相对帐户首选项屏幕。 其xml大致如下所示:

<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
    android:accountType="lorenzoff_account"
    android:icon="@drawable/nice_icon"
    android:smallIcon="@drawable/nice_icon"
    android:label="@string/app_name" 
    android:accountPreferences="@xml/account_preferences" />
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
   <PreferenceCategory android:title="@string/title_fmt" />
   <PreferenceScreen
        android:key="key1"
        android:title="click me"
        android:summary="dont be afraid, click!">
        <intent
            android:action="com.lorenzoff.authenticator.ACTION_UNKNOWN"
            android:targetPackage="key1.package"
            android:targetClass="key1.class" />
    </PreferenceScreen>
</PreferenceScreen>


我的问题是,我不知道如何在意向接收类中区分这两个帐户。如果我单击account_A或account_B,在这两种情况下,接收类都会正确接收com.lorenzoff.authenticator.ACTION_未知操作,但我如何确定单击的是account_A还是account_B?

一些实验表明,标准Android设置应用程序通过键
“account”传递目标帐户
在附带启动
android:accountPreferences
活动的附加包中

不幸的是,我似乎也看不到任何文档来保证这是否总是正确的;如果有人能证明不是这样,那就太好了