I integrated Google Drive API to my Android app but recently I noticed that this stop working, earlier everything was ok. Now I get GoogleAuthException: Unknown on getToken() function. I tested on Nexus 7 with Android 4.4.4. My app is compiled woth Google APIs 4.2.2.
Here is my code:
public Account getAccount() {
if (mSelectedAccountName != null) {
return mAccountManager.getAccountByName(mSelectedAccountName);
}
return null;
}
private void checkIfUserIsAuthenticated(Activity context, boolean showAuthActivity) {
if (mSelectedAccountName != null) {
try {
Account account = getAccount();
if (account != null) {
mCredential.setSelectedAccountName(mSelectedAccountName);
mService = getDriveService(mCredential);
mCredential.getToken();
mIsUserAuthenticated = true;
}
} catch (UserRecoverableAuthException e) {
mIsUserAuthenticated = false;
if (showAuthActivity) {
showAuthenticationActivity(context, e.getIntent());
}
} catch (IOException e) {
e.printStackTrace();
} catch (GoogleAuthException e) {
e.printStackTrace();
mIsUserAuthenticated = false;
}
}
}
Does anybody know what can happened?