我需要在成功登录后从Google获取访问令牌。我使用下面的代码但我收到此错误([ERROR] IO Exception: java.io.IOException: NetworkError
)。请任何人帮助我。
try {
token = GoogleAuthUtil.getToken(
DoctorDetailsActivity.this, // Context context
accountName, // String accountName
"http://www.google.com/m8/feeds/"
);
} catch (IOException transientEx) {
// network or server error, the call is expected to succeed if you try again later.
// Don't attempt to call again immediately - the request is likely to
// fail, you'll hit quotas or back-off.
Log.e("getAccessToken()", "[ERROR] IOException: " + transientEx);
} catch (UserRecoverableAuthException e) {
// Recover
Log.e("getAccessToken()", "[ERROR] UserRecoverableAuthException: " + e);
} catch (GoogleAuthException authEx) {
// Failure. The call is not expected to ever succeed so it should not be
// retried.
Log.e("getAccessToken()", "[ERROR] GoogleAuthException: " + authEx);
} catch (Exception e) {
Log.e("getAccessToken()", "[ERROR] Exception: " + e);
throw new RuntimeException(e);
}