List of usage examples for android.accounts AccountManager blockingGetAuthToken
public String blockingGetAuthToken(Account account, String authTokenType, boolean notifyAuthFailure) throws OperationCanceledException, IOException, AuthenticatorException
From source file:org.opendatakit.sync.aggregate.AggregateSynchronizer.java
public String updateAccessToken() throws InvalidAuthTokenException { AccountManager accountManager = AccountManager.get(context); try {/* w ww .j ava2 s . c om*/ SyncPreferences prefs = new SyncPreferences(context, appName); Account account = new Account(prefs.getAccount(), ACCOUNT_TYPE_G); this.accessToken = accountManager.blockingGetAuthToken(account, authString, true); return accessToken; } catch (Exception e) { e.printStackTrace(); throw new InvalidAuthTokenException("unable to update access token -- please re-authorize"); } }