This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private String updateToken(boolean invalidateToken) { | |
String authToken = "null"; | |
try { | |
AccountManager am = AccountManager.get(getApplicationContext()); | |
Account[] accounts = am.getAccountsByType("com.google"); | |
AccountManagerFuture<Bundle> accountManagerFuture; | |
if (this == null) {//this is used when calling from an interval thread | |
accountManagerFuture = am.getAuthToken(accounts[0], "oauth2:https://www.googleapis.com/auth/userinfo.profile" , false, null, null); | |
} else { | |
accountManagerFuture = am.getAuthToken(accounts[0], "oauth2:https://www.googleapis.com/auth/userinfo.profile" , null, this, null, null); |