我将Google云端硬盘API集成到了我的Android应用中,但最近我发现这停止了工作,之前一切正常。现在我得到了GoogleAuthException:getToken()函数未知。我使用Android 4.4.4在Nexus 7上进行了测试。我的应用程序是使用Google API 4.2.2编译的。
这是我的代码:
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;
}
}
}
有人知道会发生什么吗?