Ich möchte den Vor- und Nachnamen eines Google-Kontos mit der gdata-Bibliothek erhalten. Ich habe das Authentifizierungs-Token (ich nehme es von Android-Gerät - senden Sie es an mein Java-Servlet- dann sollte eine Einfügung in eine MySQL-Datenbank mit ersten, letzten, Anzeigenamen und provider_uid hinzufügen (provider_uid ist die Form von https://www.google.com/accounts/o8/id?id=AItOawmyn ...)) .gDaten: Konto (Selbstkontakt) Vor- und Nachname
habe ich Kontakte wie diese Futtermittel (ohne Erfolg):
public String tryGoogleAuthentication(String auth_token){
ContactsService contactsService = new ContactsService("...");
contactsService.setUserToken(auth_token);
//contactsService.setAuthSubToken(auth_token);
ContactFeed feed = null;
try {
feed = contactsService.getFeed(new URL("https://www.google.com/m8/feeds/contacts/" + "[email protected]" + "/full?max-results=10000"), ContactFeed.class);
} catch (IOException e) {
e.printStackTrace();
return CONST.GOOGLE_AUTH_INVALID_TOKEN;
} catch (ServiceException e) {
e.printStackTrace();
return CONST.GOOGLE_AUTH_INVALID_TOKEN;
} catch (NullPointerException e) {
e.printStackTrace();
return CONST.GOOGLE_AUTH_INVALID_TOKEN;
}
if (feed == null)
return "";
String externalId = feed.getId();
Person person = feed.getAuthors().get(0);
String email = person.getEmail();
String name = person.getName();
String nameLang = person.getNameLang();
String extensionLocalName = person.getExtensionLocalName();
String uri = person.getUri();
System.out.println("externalId: " + externalId);
System.out.println("email: " + email);
System.out.println("name: " + name);
System.out.println("nameLang: " + nameLang);
System.out.println("extension local name: " + extensionLocalName);
System.out.println("URI: " + uri);
System.out.println(feed.getSelf().getEntries().get(0).getTitle().getPlainText());
return CONST.STATUS_OK;
}
Auch
System.out.println("ID: " + feed.getSelf().getEntries().get(0).getId());
AUSGABE:
ID: http://www.google.com/m8/feeds/contacts/someEmail%40gmail.com/base/c....
aber ich möchte etwas wie folgt aus:
https://www.google.com/accounts/o8/id?id=AItOawmyn...
Ich brauche dies in eine bestehende Datenbank einfügen.
Bitte beachten Sie, dass ich die Informationen nur für das Konto, nicht für seine Kontakte haben möchte.
Danke,
Alex
Noch niemand weiß, wie man Vor- und Nachname erhält? –