私はしばらくの間これを理解しようとしてきましたが、私が試したことは何も得られないようです。
更新トークンを取得できないようです。空白として表示されます。
public class oaUTH extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... unused) {
try {
JsonFactory jsonFactory = new JacksonFactory();
HttpTransport transport = new NetHttpTransport();
CredentialStore credentialStore = new SharedPreferencesCredentialStore(prefs);
AccessTokenResponse accessTokenResponse = credentialStore.read();
GoogleAccessProtectedResource accessProtectedResource = new GoogleAccessProtectedResource(accessTokenResponse.accessToken,
transport,
jsonFactory,
OAuth2ClientCredentials.CLIENT_ID,
OAuth2ClientCredentials.CLIENT_SECRET,
accessTokenResponse.refreshToken+"&access_type=offline");
final Latitude latitude = new Latitude(transport, accessProtectedResource, jsonFactory);
latitude.apiKey=OAuth2ClientCredentials.API_KEY;
Log.i("AGENTPORTAL", "Access Token = " + accessTokenResponse.accessToken + ", Expires in = " + accessTokenResponse.expiresIn + ", Refresh Token = " + accessTokenResponse.refreshToken + ", Scope = " + accessTokenResponse.scope);
LatitudeCurrentlocationResourceJson currentLocation = latitude.currentLocation.get().execute();
String locationAsString = convertLocationToString(currentLocation);
Log.i("TAG", locationAsString);
//textView.setText(locationAsString);
} catch (Exception ex) {
ex.printStackTrace();
//textView.setText("Error occured : " + ex.getMessage());
startActivity(new Intent().setClass(getApplicationContext(),OAuthAccessTokenActivity.class));
}
ログは次のとおりです: アクセス トークン = **AHES6ZTeqgwdxjll6Gb4Cf9I0_n5bO_OdgR2OR* *WLPCPzJ5xtO5M、有効期限 = 3599、リフレッシュ トークン = 、スコープ =
refresh token = " " のどこにアイデアがありますか? 「&access_type=offline」を追加しましたが、まだ運がありません。どんな助けでも大歓迎です!