List of usage examples for android.accounts AuthenticatorException printStackTrace
public void printStackTrace()
From source file:com.google.appinventor.components.runtime.util.ClientLoginHelper.java
/** * Uses Google Account Manager to retrieve auth token that can * be used to access various Google APIs -- e.g., the Google Voice api. *//*from w w w . j av a2 s .c om*/ public String getAuthToken() throws ClientProtocolException { Account account = accountChooser.findAccount(); if (account != null) { AccountManagerFuture<Bundle> future; future = accountManager.getAuthToken(account, service, null, activity, null, null); Log.i(LOG_TAG, "Have account, auth token: " + future); Bundle result; try { result = future.getResult(); return result.getString(AccountManager.KEY_AUTHTOKEN); } catch (AuthenticatorException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (OperationCanceledException e) { e.printStackTrace(); } } throw new ClientProtocolException("Can't get valid authentication token"); }
From source file:com.rukman.emde.smsgroups.syncadapter.SyncAdapter.java
@Override public void onPerformSync(Account account, Bundle extras, String authority, ContentProviderClient provider, SyncResult syncResult) {/*ww w . j a v a2 s . co m*/ try { // Use the account manager to request the AuthToken we'll need // to talk to our sample server. If we don't have an AuthToken // yet, this could involve a round-trip to the server to request // and AuthToken. if (!shouldSyncNow(account, extras, provider, syncResult)) { Log.i(TAG, "Syncing despite shouldSyncNow()"); } final String authToken = mAccountManager.blockingGetAuthToken(account, GMSApplication.AUTHTOKEN_TYPE, NOTIFY_AUTH_FAILURE); processDeletedContacts(provider, authToken, account, syncResult); processDeletedGroups(provider, authToken, account, syncResult); syncGroupsWithServer(provider, authToken, account, syncResult); updateSyncRecord(provider); } catch (final AuthenticatorException e) { Log.e(TAG, "AuthenticatorException", e); syncResult.stats.numParseExceptions++; } catch (final OperationCanceledException e) { Log.e(TAG, "OperationCanceledExcetpion", e); } catch (final IOException e) { Log.e(TAG, "IOException", e); syncResult.stats.numIoExceptions++; } catch (final ParseException e) { Log.e(TAG, "ParseException", e); syncResult.stats.numParseExceptions++; } catch (JSONException e) { Log.e(TAG, "JSONException", e); syncResult.stats.numParseExceptions++; } catch (RemoteException e) { Log.e(TAG, "RemoteException", e); syncResult.stats.numIoExceptions++; } catch (OperationApplicationException e) { syncResult.stats.numIoExceptions++; e.printStackTrace(); } }