その上:
@Override
public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account) {
Bundle result = new Bundle();
boolean allowed = false; // or whatever logic you want here
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, allowed);
return result;
}
は、マニフェストにこれを追加します。
を
<service android:name=".auth.AuthenticationService">
<intent-filter>
<action android:name="android.accounts.AccountAuthenticator"></action>
</intent-filter>
<meta-data android:name="android.accounts.AccountAuthenticator" android:resource="@xml/authenticator"></meta-data>
</service>
(lintは、このエクスポートされたサービスにアクセス許可が必要ないことを警告します)。
そしてRES/XMLでauthenticator.xmlファイルを追加します
<?xml version="1.0" encoding="utf-8"?>
<account-authenticator
xmlns:android="http://schemas.android.com/apk/res/android"
android:accountType="com.companyname"
android:icon="@drawable/app_icon"
android:smallIcon="@drawable/app_icon_small"
android:label="@string/app_name" />
は、アカウントの種類が "com.companyname" であると仮定します。これが私たちがやっていることであり、API 8から作業しているようです。