List of usage examples for android.accounts AccountManager KEY_BOOLEAN_RESULT
String KEY_BOOLEAN_RESULT
To view the source code for android.accounts AccountManager KEY_BOOLEAN_RESULT.
Click Source Link
From source file:edu.mit.mobile.android.locast.accounts.Authenticator.java
/** * {@inheritDoc}/* w ww . ja v a2 s.c om*/ */ @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { if (options != null && options.containsKey(AccountManager.KEY_PASSWORD)) { final String password = options.getString(AccountManager.KEY_PASSWORD); final Bundle verified = onlineConfirmPassword(account, password); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, verified != null); return result; } // Launch AuthenticatorActivity to confirm credentials final Intent intent = new Intent(mContext, AuthenticatorActivity.class); intent.putExtra(AuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AuthenticatorActivity.EXTRA_CONFIRMCREDENTIALS, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticator.java
/** * {@inheritDoc}//from w w w. j av a 2 s . co m */ @Override public Bundle confirmCredentials(AccountAuthenticatorResponse response, Account account, Bundle options) { if (options != null && options.containsKey(AccountManager.KEY_PASSWORD)) { final String password = options.getString(AccountManager.KEY_PASSWORD); final Bundle verified = onlineConfirmPassword(account, password); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, verified != null); return result; } // Launch AuthenticatorActivity to confirm credentials final Intent intent = getAuthenticator(mContext); intent.putExtra(AbsLocastAuthenticatorActivity.EXTRA_USERNAME, account.name); intent.putExtra(AbsLocastAuthenticatorActivity.EXTRA_CONFIRMCREDENTIALS, true); intent.putExtra(AccountManager.KEY_ACCOUNT_AUTHENTICATOR_RESPONSE, response); final Bundle bundle = new Bundle(); bundle.putParcelable(AccountManager.KEY_INTENT, intent); return bundle; }
From source file:org.klnusbaum.udj.auth.Authenticator.java
@Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] freaturs) { final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); return result; }
From source file:dev.drsoran.moloko.auth.AuthenticatorActivity.java
/** * Response is received from the server for authentication request. Sets the AccountAuthenticatorResult which is sent * back to the caller. Also sets the authToken in AccountManager for this account. *///from w ww . ja va 2 s . c o m @Override public void onAuthenticationFinished(RtmAuth rtmAuth) { final Account account = new Account(rtmAuth.getUser().getUsername(), Constants.ACCOUNT_TYPE); try { boolean ok = true; if (isNewAccount) { ok = accountManager.addAccountExplicitly(account, rtmAuth.getToken(), null); if (ok) { ContentResolver.setSyncAutomatically(account, Rtm.AUTHORITY, true); } } if (ok) { accountManager.setUserData(account, Constants.FEAT_API_KEY, MolokoApp.getRtmApiKey(this)); accountManager.setUserData(account, Constants.FEAT_SHARED_SECRET, MolokoApp.getRtmSharedSecret(this)); accountManager.setUserData(account, Constants.FEAT_PERMISSION, rtmAuth.getPerms().toString()); accountManager.setUserData(account, Constants.ACCOUNT_USER_ID, rtmAuth.getUser().getId()); accountManager.setUserData(account, Constants.ACCOUNT_FULLNAME, rtmAuth.getUser().getFullname()); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, rtmAuth.getUser().getUsername()); // We store the authToken as password intent.putExtra(AccountManager.KEY_PASSWORD, rtmAuth.getToken()); intent.putExtra(AccountManager.KEY_ACCOUNT_TYPE, Constants.ACCOUNT_TYPE); intent.putExtra(AccountManager.KEY_AUTHTOKEN, rtmAuth.getToken()); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, true); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); } } catch (SecurityException e) { MolokoApp.Log.e(getClass(), e.getLocalizedMessage()); onAuthenticationFailed(getString(R.string.auth_err_cause_scurity)); } finally { finish(); } }
From source file:com.manning.androidhacks.hack023.authenticator.Authenticator.java
@Override public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account) throws NetworkErrorException { Bundle result = super.getAccountRemovalAllowed(response, account); if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT) && !result.containsKey(AccountManager.KEY_INTENT)) { boolean allowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); if (allowed) { for (int i = 0; i < authoritiesToSync.length; i++) { ContentResolver.cancelSync(account, authoritiesToSync[i]); }//from w w w . j a v a 2 s. c o m mContext.deleteDatabase(DatabaseHelper.DATABASE_NAME); } } return result; }
From source file:com.pindroid.authenticator.AuthenticatorActivity.java
/** * Called when response is received from the server for confirm credentials * request. See onAuthenticationResult(). Sets the * AccountAuthenticatorResult which is sent back to the caller. * // w w w. j av a 2 s . co m * @param the confirmCredentials result. */ protected void finishConfirmCredentials(String authToken) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(mUsername, Constants.ACCOUNT_TYPE); mAccountManager.setAuthToken(account, Constants.AUTHTOKEN_TYPE, authToken); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, authToken != null); intent.putExtra(AccountManager.KEY_AUTHTOKEN, authToken); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:com.clearcenter.mobile_demo.mdAuthenticator.java
public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) { // This call is used to query whether the Authenticator supports // specific features. We don't expect to get called, so we always // return false (no) for any queries. Log.v(TAG, "hasFeatures()"); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); return result; }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticator.java
/** * {@inheritDoc}/* ww w.java 2 s . com*/ */ @Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) { final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); return result; }
From source file:pt.up.mobile.authenticator.Authenticator.java
@Override public Bundle hasFeatures(AccountAuthenticatorResponse response, Account account, String[] features) { // This call is used to query whether the Authenticator supports // specific features. We don't expect to get called, so we always // return false (no) for any queries. Log.v(TAG, "hasFeatures()"); final Bundle result = new Bundle(); result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, false); return result; }
From source file:pt.up.mobile.authenticator.AuthenticatorActivity.java
/** * Called when response is received from the server for confirm credentials * request. See onAuthenticationResult(). Sets the * AccountAuthenticatorResult which is sent back to the caller. * /*from www . ja v a 2 s . c o m*/ * @param result * the confirmCredentials result. */ private void finishConfirmCredentials(boolean result) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(mUsername, Constants.ACCOUNT_TYPE); mAccountManager.setPassword(account, mPassword); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_ACCOUNT_NAME, mUsername); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }