android.accounts.AccountManagerFuture Java Examples
The following examples show how to use
android.accounts.AccountManagerFuture.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: AndroidAuthenticator.java From android-common-utils with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #2
Source File: MainPresenter.java From Pioneer with Apache License 2.0 | 6 votes |
private void fetchPioneerAccount() { String ACCOUNT_TYPE = "com.github.baoti"; String AUTH_TOKEN_TYPE = "pioneer"; accountManager.getAuthTokenByFeatures(ACCOUNT_TYPE, AUTH_TOKEN_TYPE, null, getView().getActivity(), null, null, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle result = future.getResult(); String name = result.getString(AccountManager.KEY_ACCOUNT_NAME); String type = result.getString(AccountManager.KEY_ACCOUNT_TYPE); String token = result.getString(AccountManager.KEY_AUTHTOKEN); toaster.show( String.format("Auth result - name: %s, type: %s, token: %s", name, type, token)); } catch (Exception e) { e.printStackTrace(); } } }, null); }
Example #3
Source File: AndroidAuthenticator.java From CrossBow with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #4
Source File: MyAccountActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void removeAccount(final Account account) { SharedPreferences sharedPreferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); sharedPreferences.edit().remove("queueName").apply(); ContentResolver.setIsSyncable(account, WEBINSTALL_SYNC_AUTHORITY, 0); ContentResolver.setSyncAutomatically(account, MyAccountActivity.WEBINSTALL_SYNC_AUTHORITY, false); if(Build.VERSION.SDK_INT>=8){ ContentResolver.removePeriodicSync(account, MyAccountActivity.WEBINSTALL_SYNC_AUTHORITY, new Bundle()); } mAccountManager.removeAccount(account, new AccountManagerCallback<Boolean>() { @Override public void run(AccountManagerFuture<Boolean> future) { addAccount(); finish(); } }, null); }
Example #5
Source File: AndroidAuthenticator.java From DaVinci with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #6
Source File: AndroidAuthenticator.java From volley_demo with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #7
Source File: AndroidAuthenticator.java From volley with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #8
Source File: AndroidAuthenticator.java From WayHoo with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #9
Source File: ContentManager.java From retrowatch with Apache License 2.0 | 6 votes |
public synchronized void queryGmailLabels() { // Get the account list, and pick the user specified address AccountManager.get(mContext).getAccountsByTypeAndFeatures(ACCOUNT_TYPE_GOOGLE, FEATURES_MAIL, new AccountManagerCallback<Account[]>() { @Override public void run(AccountManagerFuture<Account[]> future) { Account[] accounts = null; try { accounts = future.getResult(); } catch (OperationCanceledException oce) { Logs.e(TAG, "Got OperationCanceledException: "+oce.toString()); } catch (IOException ioe) { Logs.e(TAG, "Got OperationCanceledException: "+ioe.toString()); } catch (AuthenticatorException ae) { Logs.e(TAG, "Got OperationCanceledException: "+ae.toString()); } mGmailUnreadCount = onAccountResults(accounts); addGmailToContentList(mGmailUnreadCount); Logs.d(TAG, "# Gmail unread count = "+ mGmailUnreadCount); } }, null /* handler */); }
Example #10
Source File: AndroidAuthenticator.java From jus with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getToken() throws AndroidAuthError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AndroidAuthError("Error while retrieving auth token", e); } if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AndroidAuthError(intent, null); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AndroidAuthError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #11
Source File: AndroidAuthenticator.java From okulus with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #12
Source File: OdooAccountManager.java From framework with GNU Affero General Public License v3.0 | 6 votes |
/** * Remove account from device * * @param context * @param username * @return true, if account removed successfully */ public static boolean removeAccount(Context context, String username) { OUser user = getDetails(context, username); if (user != null) { AccountManager accountManager = AccountManager.get(context); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP_MR1) { if (accountManager.removeAccountExplicitly(user.getAccount())) { dropDatabase(user); } return true; } else { try { AccountManagerFuture<Boolean> result = accountManager. removeAccount(user.getAccount(), null, null); if (result.getResult()) { dropDatabase(user); } return true; } catch (OperationCanceledException | IOException | AuthenticatorException e) { e.printStackTrace(); } } } return false; }
Example #13
Source File: MyAccountActivity.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void addAccount() { mAccountManager.addAccount(Aptoide.getConfiguration().getAccountType(), AptoideConfiguration.AccountGeneral.AUTHTOKEN_TYPE_FULL_ACCESS, null, null, this, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle bnd = future.getResult(); if (bnd.containsKey(AccountManager.KEY_AUTHTOKEN)) { setContentView(R.layout.form_logout); } else { finish(); } } catch (Exception e) { e.printStackTrace(); } } }, null); }
Example #14
Source File: AndroidAuthenticator.java From pearl with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #15
Source File: AndroidAuthenticator.java From product-emm with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #16
Source File: AndroidAuthenticator.java From device-database with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #17
Source File: AndroidAuthenticator.java From SaveVolley with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #18
Source File: AndroidAuthenticator.java From SaveVolley with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #19
Source File: AndroidAuthenticator.java From product-emm with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #20
Source File: AndroidAuthenticator.java From android-discourse with Apache License 2.0 | 6 votes |
@Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #21
Source File: AccountResolver.java From RememBirthday with GNU General Public License v3.0 | 6 votes |
/** * Remove account from Android system */ @SuppressWarnings("deprecation") public boolean removeAccount() { Log.d(getClass().getSimpleName(), "Removing account : " + account.name); AccountManager accountManager = AccountManager.get(context); // remove account AccountManagerFuture accountManagerFuture; if(android.os.Build.VERSION.SDK_INT < 23) { accountManagerFuture = accountManager.removeAccount(account, null, null); } else { accountManagerFuture = accountManager.removeAccount(account, null, null, null); } if (accountManagerFuture.isDone()) { try { accountManagerFuture.getResult(); return true; } catch (Exception e) { Log.e(getClass().getSimpleName(), "Problem while removing account!", e); return false; } } else { return false; } }
Example #22
Source File: AndroidAuthenticator.java From android-project-wo2b with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #23
Source File: MainPresenter.java From Pioneer with Apache License 2.0 | 6 votes |
private void fetchPioneerAccount() { String ACCOUNT_TYPE = "com.github.baoti"; String AUTH_TOKEN_TYPE = "pioneer"; accountManager.getAuthTokenByFeatures(ACCOUNT_TYPE, AUTH_TOKEN_TYPE, null, getView().getActivity(), null, null, new AccountManagerCallback<Bundle>() { @Override public void run(AccountManagerFuture<Bundle> future) { try { Bundle result = future.getResult(); String name = result.getString(AccountManager.KEY_ACCOUNT_NAME); String type = result.getString(AccountManager.KEY_ACCOUNT_TYPE); String token = result.getString(AccountManager.KEY_AUTHTOKEN); toaster.show( String.format("Auth result - name: %s, type: %s, token: %s", name, type, token)); } catch (Exception e) { e.printStackTrace(); } } }, null); }
Example #24
Source File: AndroidAuthenticator.java From SimplifyReader with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #25
Source File: BaseActivity.java From attendee-checkin with Apache License 2.0 | 6 votes |
@Override public void run(AccountManagerFuture<Bundle> bundleAccountManagerFuture) { try { Bundle result = bundleAccountManagerFuture.getResult(); Intent intent = (Intent) result.get(AccountManager.KEY_INTENT); if (intent == null) { String authToken = result.getString(AccountManager.KEY_AUTHTOKEN); GutenbergApplication app = GutenbergApplication.from(BaseActivity.this); app.setAuthToken(authToken); app.requestSync(false); } else { startActivityForResult(intent, REQUEST_AUTHENTICATE); } } catch (OperationCanceledException | IOException | AuthenticatorException e) { Log.e(TAG, "Error authenticating.", e); } }
Example #26
Source File: AutoLoginAccountDelegate.java From android-chromium with BSD 2-Clause "Simplified" License | 6 votes |
@Override public void run(AccountManagerFuture<Bundle> value) { String result = null; try { result = value.getResult().getString(AccountManager.KEY_AUTHTOKEN); } catch (Exception e) { result = null; } final boolean success = result != null; // Can't rely on the Bundle's auth token or account name as they might be null // if this was a failed attempt. if (mAutoLoginProcessor != null) { mAutoLoginProcessor.processAutoLoginResult(getAccountName(), getAuthToken(), success, result); } }
Example #27
Source File: AndroidAuthenticator.java From TitanjumNote with Apache License 2.0 | 6 votes |
@SuppressWarnings("deprecation") @Override public String getAuthToken() throws AuthFailureError { AccountManagerFuture<Bundle> future = mAccountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #28
Source File: AndroidAuthenticator.java From android_tv_metro with Apache License 2.0 | 6 votes |
@Override public String getAuthToken() throws AuthFailureError { final AccountManager accountManager = AccountManager.get(mContext); AccountManagerFuture<Bundle> future = accountManager.getAuthToken(mAccount, mAuthTokenType, mNotifyAuthFailure, null, null); Bundle result; try { result = future.getResult(); } catch (Exception e) { throw new AuthFailureError("Error while retrieving auth token", e); } String authToken = null; if (future.isDone() && !future.isCancelled()) { if (result.containsKey(AccountManager.KEY_INTENT)) { Intent intent = result.getParcelable(AccountManager.KEY_INTENT); throw new AuthFailureError(intent); } authToken = result.getString(AccountManager.KEY_AUTHTOKEN); } if (authToken == null) { throw new AuthFailureError("Got null auth token for type: " + mAuthTokenType); } return authToken; }
Example #29
Source File: AuthUtils.java From Indic-Keyboard with Apache License 2.0 | 5 votes |
/** * @see AccountManager#getAuthToken( * Account, String, Bundle, boolean, AccountManagerCallback, Handler) */ public AccountManagerFuture<Bundle> getAuthToken(final Account account, final String authTokenType, final Bundle options, final boolean notifyAuthFailure, final AccountManagerCallback<Bundle> callback, final Handler handler) { return mAccountManager.getAuthToken(account, authTokenType, options, notifyAuthFailure, callback, handler); }
Example #30
Source File: AndroidAuthenticatorTest.java From CrossBow with Apache License 2.0 | 5 votes |
@Before public void setUp() { mAccountManager = mock(AccountManager.class); mFuture = mock(AccountManagerFuture.class); mAccount = new Account("coolperson", "cooltype"); mAuthenticator = new AndroidAuthenticator(mAccountManager, mAccount, "cooltype", false); }