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:eu.masconsult.bgbanking.accounts.AccountAuthenticator.java
@Override public Bundle getAccountRemovalAllowed(AccountAuthenticatorResponse response, Account account) throws NetworkErrorException { Log.v(TAG, "getAccountRemovalAllowed(account: " + account + ")"); Bundle result = super.getAccountRemovalAllowed(response, account); if (result != null && result.containsKey(AccountManager.KEY_BOOLEAN_RESULT) && !result.containsKey(AccountManager.KEY_INTENT)) { final boolean removalAllowed = result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT); if (removalAllowed) { // Do my removal stuff here BankAccountManager.removeAccount(context, account); }/*from www .j av a 2 s.co m*/ } return result; }
From source file:com.rukman.emde.smsgroups.authenticator.GMSAuthenticatorActivity.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. * * @param result the confirmCredentials result. *//* w ww. jav a2 s . co m*/ private void finishConfirmCredentials(boolean result) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(mUsername, GMSApplication.ACCOUNT_TYPE); mAccountManager.setPassword(account, mPassword); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:org.klnusbaum.udj.auth.AuthActivity.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. * * @param result the confirmCredentials result. *//*ww w .j a v a 2s. c o m*/ 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_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:edu.mit.mobile.android.locast.accounts.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 w w w . ja v a2s .co m * * @param the * confirmCredentials result. */ protected void finishConfirmCredentials(boolean result) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(mUsername, AuthenticationService.ACCOUNT_TYPE); mAccountManager.setPassword(account, mPassword); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:uk.co.bubblebearapps.contactsintegration.MainActivity.java
private void removeAccount(Account account) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { mAccountManager.removeAccount(account, this, new AccountManagerCallback<Bundle>() { @Override/*ww w.jav a2 s. c o m*/ public void run(AccountManagerFuture<Bundle> future) { try { Boolean result = future.getResult().getBoolean(AccountManager.KEY_BOOLEAN_RESULT); if (result) { showMessage("Account deleted"); } else { showMessage("Account not deleted"); } } catch (Exception e) { e.printStackTrace(); showMessage(e.getMessage()); } } }, new Handler()); } else { mAccountManager.removeAccount(account, new AccountManagerCallback<Boolean>() { @Override public void run(AccountManagerFuture<Boolean> future) { try { Boolean result = future.getResult(); if (result) { showMessage("Account deleted"); } else { showMessage("Account not deleted"); } } catch (Exception e) { e.printStackTrace(); showMessage(e.getMessage()); } } }, new Handler()); } }
From source file:com.nbos.phonebook.sync.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. * // www . ja va 2s .c om * @param the confirmCredentials result. */ protected void finishConfirmCredentials(boolean result) { Log.i(tag, "finishConfirmCredentials()"); final Account account = new Account(mUsername, Constants.ACCOUNT_TYPE); mAccountManager.setPassword(account, mPassword); mAccountManager.setUserData(account, Constants.PHONE_NUMBER_KEY, countryCode + mPhone); Db.deleteServerData(getApplicationContext()); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:org.ohmage.auth.Authenticator.java
@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:com.sefford.beauthentic.activities.LoginActivity.java
void performLogin() { final AccountManager am = AccountManager.get(this); final Bundle data = new Bundle(); data.putString(AuthenticAuthenticator.EXTRA_PASSWORD, etPassword.getText().toString()); data.putInt(AuthenticAuthenticator.EXTRA_TYPE, AuthenticAuthenticator.Type.PASSWORD.ordinal()); final Account account = new Account(etUsername.getText().toString(), AuthenticAuthenticator.ACCOUNT_TYPE); am.getAuthToken(account, "", data, true, new AccountManagerCallback<Bundle>() { @Override/*from w w w. j a v a 2s. c om*/ public void run(AccountManagerFuture<Bundle> future) { try { final Bundle result = future.getResult(); if (result.getBoolean(AccountManager.KEY_BOOLEAN_RESULT)) { Sessions.addAccount(am, account, etPassword.getText().toString(), Bundle.EMPTY); am.setAuthToken(account, AuthenticAuthenticator.AUTHTOKEN_TYPE, result.getString(AccountManager.KEY_AUTHTOKEN)); am.setUserData(account, AuthenticAuthenticator.EXTRA_TYPE, Integer.toString(AuthenticAuthenticator.Type.PASSWORD.ordinal())); notifyLoginToGCM(AuthenticAuthenticator.Type.PASSWORD.ordinal(), account.name, etPassword.getText().toString(), result.getString(AccountManager.KEY_AUTHTOKEN)); googleApi .saveCredential( new Credential.Builder(account.name) .setPassword(etPassword.getText().toString()).build(), new SmartlockCredentialCallback()); } else { Snackbar.make(vLoginForm, R.string.error_invalid_credentials, Snackbar.LENGTH_LONG).show(); } } catch (OperationCanceledException e) { Snackbar.make(vLoginForm, R.string.error_operation_cancelled, Snackbar.LENGTH_LONG).show(); } catch (IOException e) { Snackbar.make(vLoginForm, R.string.error_not_connected_to_internet, Snackbar.LENGTH_LONG) .show(); } catch (AuthenticatorException e) { Snackbar.make(vLoginForm, R.string.error_invalid_credentials, Snackbar.LENGTH_LONG).show(); } } }, null); }
From source file:edu.mit.mobile.android.locast.accounts.AbsLocastAuthenticatorActivity.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 ww w . j ava 2 s . com*/ * * @param the * confirmCredentials result. */ protected void finishConfirmCredentials(boolean result) { if (BuildConfig.DEBUG) { Log.i(TAG, "finishConfirmCredentials()"); } final Account account = createAccount(mUsername); mAccountManager.setPassword(account, mPassword); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }
From source file:com.clearcenter.mobile_demo.mdAuthenticatorActivity.java
private void finishConfirmCredentials(boolean result, String authToken) { Log.i(TAG, "finishConfirmCredentials()"); final Account account = new Account(nickname, mdConstants.ACCOUNT_TYPE); if (result)/*w ww .ja v a 2s . c om*/ account_manager.setPassword(account, authToken); final Intent intent = new Intent(); intent.putExtra(AccountManager.KEY_BOOLEAN_RESULT, result); setAccountAuthenticatorResult(intent.getExtras()); setResult(RESULT_OK, intent); finish(); }