Back to project page sigimera-android-app.
The source code is released under:
GNU General Public License
If you think the Android project sigimera-android-app listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.sigimera.app.android.backend.auth; /*from w w w .j av a 2 s. c o m*/ import android.accounts.AbstractAccountAuthenticator; import android.accounts.Account; import android.accounts.AccountAuthenticatorResponse; import android.accounts.AccountManager; import android.accounts.NetworkErrorException; import android.content.Context; import android.content.Intent; import android.os.Bundle; /** * For the implementation see ~/android/android-sdk-linux/samples/android-8/SampleSyncAdapter * @author Alex Oberhauser * */ public class AccountAuthenticator extends AbstractAccountAuthenticator { private final Context context; public AccountAuthenticator(Context _context) { super(_context); this.context = _context; } @Override public Bundle addAccount(AccountAuthenticatorResponse response, String accountType, String authTokenType, String[] requiredFeatures, Bundle options) throws NetworkErrorException { final Intent intent = new Intent(context, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.PARAM_AUTHTOKEN_TYPE, authTokenType); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; } @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) throws NetworkErrorException { // TODO Auto-generated method stub if (options != null && options.containsKey(AccountManager.KEY_PASSWORD)) { // final String password = // options.getString(AccountManager.KEY_PASSWORD); // final boolean verified = // onlineConfirmPassword(account.name, password); final Bundle result = new Bundle(); // result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, verified); return result; } return null; } @Override public Bundle editProperties(AccountAuthenticatorResponse response, String accountType) { // TODO Auto-generated method stub return null; } @Override public Bundle getAuthToken(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { // TODO Auto-generated method stub return null; } @Override public String getAuthTokenLabel(String authTokenType) { // TODO Auto-generated method stub return null; } @Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) throws NetworkErrorException { // TODO Auto-generated method stub return null; } @Override public Bundle updateCredentials(AccountAuthenticatorResponse response, Account account, String authTokenType, Bundle options) throws NetworkErrorException { // TODO Auto-generated method stub return null; } }