ダミーアカウントを使用して同期アダプタを作成しましたが、設定アプリケーションのアカウントリストに表示したくない場合や、設定の[アカウントの追加] 。私は、アンドロイド:userVisible = "false"を使ってみましたが、アカウントは表示されています。私はエミュレータと3つの物理デバイスでこれを試しました。すべては、必要なすべてのデータを同期するという点で正しく機能しますが、唯一間違っているのは、リストにアカウントが表示されていることです。設定から同期アダプタのダミーアカウントを非表示にする
マイauthenticator.xmlは次のとおりです。
<sync-adapter xmlns:android="http://schemas.android.com/apk/res/android"
android:contentAuthority="net.astagor.android.hhp"
android:accountType="net.astagor.android.hhp.account"
android:userVisible="false"
android:supportsUploading="true"
android:allowParallelSyncs="false"
android:isAlwaysSyncable="true"
/>
そして、私はこのように私の特殊なアダプタを追加します:
<account-authenticator xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="net.astagor.android.hhp.account"
android:icon="@drawable/ic_launcher"
android:smallIcon="@drawable/ic_launcher"
android:label="@string/app_name"
/>
マイsyncadapter.xmlがある私が手
Account account = AuthenticatorService.GetAccount();
AccountManager accountManager = (AccountManager) context
.getSystemService(Context.ACCOUNT_SERVICE);
if (accountManager.addAccountExplicitly(account, null, null)) {
ContentResolver.setIsSyncable(account, StubProvider.AUTHORITY, 1);
ContentResolver.setSyncAutomatically(account,
StubProvider.AUTHORITY, true);
ContentResolver.addPeriodicSync(account, StubProvider.AUTHORITY,
new Bundle(), SYNC_FREQUENCY);
}
そして、アカウント一覧と追加アカウント一覧のアカウント。
お願いします! :)
私はこの質問の答えに非常に興味があります(もし良い方法があれば) –
同じ問題があります。あなたと同じようにドキュメントからすべてを取り出しました。ダミーアカウントを表示したくないのですが、それは単に常に表示されます。 :-(ここに何が壊れていますか? – Zordid