구글 인증 과정이 :
이메일 ID가
AccountManager accountManager = AccountManager.get(getApplicationContext());
Account[] accounts = accountManager.getAccountsByType("com.google");
String emailID = accounts[0].name; // you can retrieve using google account chooser way also
이 라인 (안 UI 스레드에서) 별도의 토큰으로 실행해야합니다에서 가져온 할 수 있습니다.
String scope = "oauth2:https://www.googleapis.com/auth/userinfo.profile https://gdata.youtube.com";
String accessToken = GoogleAuthUtil.getToken(mContext, emailID, scope);
accessToken을 저장하고 API 액세스에 사용합니다.
1 시간 (예 : 3600 초) 후에 액세스 토큰을 새로 고침해야합니다. 그러나 이제 Google은 한 시간 후에 액세스를 지원하지 않습니다. 응용 프로그램을 다시 시작하고 다음 줄을 사용하여 액세스 토큰을 가져와야합니다.
String scope = "oauth2:https://www.googleapis.com/auth/userinfo.profile https://gdata.youtube.com";
String accessToken = GoogleAuthUtil.getToken(mContext, emailID, scope);
이 배경 스레드는 항상 루프가
들었 동안 백그라운드에서 실행됩니다하지만이 "일회성 인증 코드를 찾을 수있는 위치를 이해하지 않았다 "내 서버로 새로 고침 토큰을 보내야합니다. 나 좀 도와 줄 수있어? – Meroelyth