我已经成功地从Google通讯录中检索了一个联系人条目,但是我还没有获得“备注”字段。我该怎么办?
这是我到目前为止所做的一部分...
public static void main(String[] args) throws IOException, ServiceException, SQLException {
System.out.println("Start elaboration");
Credential credential =authorize();
if (!credential.refreshToken()) {
throw new RuntimeException("Failed OAuth to refresh the token");
}
ContactsService myService = new ContactsService(APPLICATION_NAME);
myService.setOAuth2Credentials(credential);
URL feedUrl = new URL("https://www.google.com/m8/feeds/contacts/default/full");
Query Query = new Query(feedUrl);
Query.setMaxResults(32767);
ContactFeed feed=null;
try {
feed = myService.query(Query, ContactFeed.class);
} catch (ServiceException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
for (ContactEntry contact : feed.getEntries()) {
if (contact.hasName()) {
Name name = contact.getName();
if (name.hasFullName()) {
String fullNameToDisplay = name.getFullName().getValue();
if (name.getFullName().hasYomi()) {
fullNameToDisplay += " (" + name.getFullName().getYomi() + ")";
}
System.out.println("Full Name = " + fullNameToDisplay);
}
}
/*
* insert here the code to retrive Notes Field
*/
}
System.out.println("End elaboration");
}