Comment obtenir un jeton d'accès depuis GoogleCredential?

Je suis d'essayer d'obtenir un jeton d'accès pour utiliser le Google Play Android Développeur de l'API, et j'ai eu cette mesure à l'aide de l'API de Google Client Java documentation exemple:

HttpTransport HTTP_TRANSPORT = new NetHttpTransport();
JsonFactory JSON_FACTORY = new JacksonFactory();

GoogleCredential credential = new GoogleCredential.Builder()
    .setTransport(HTTP_TRANSPORT)
    .setJsonFactory(JSON_FACTORY)
    .setServiceAccountId("...gserviceaccount.com")
    .setServiceAccountScopes("https://www.googleapis.com/auth/androidpublisher")
    .setServiceAccountPrivateKeyFromP12File(keyFile)
    .build();

Mais comment puis-je obtenir le jeton d'accès à partir de cette identification? credential.getAccessToken() retourne null. Suis-je en train de faire quelque chose de mal, ou manquant, certaines étapes?

source d'informationauteur Kalina | 2012-09-24