CalendarService from google java client library doesn't have methods described in the tutorial
I am trying to do some work with Google Calendar on Java. So I have read the guide and downloaded client library. I have added to my project gdata-calendar-2.0.jar and gdata-client-1.0.jar from the downloaded archive.
And now, according to the documentation, I should be able to do somethink like that:
// Create a CalenderService and authenticate
CalendarService myService = new CalendarService("exampleCo-exampleApp-1");
myService.setUserCredentials("jo@gmail.com", "mypassword");
But I can't. There is no such method "setUserCredentials". Actualy there are no other mehods, mentioned i开发者_StackOverflow社区n documenation. I have decompiled CalendarService and here are all methods it have:
public CalendarService(java.lang.String applicationName)
public CalendarService(java.lang.String applicationName, com.google.gdata.client.Service.GDataRequestFactory requestFactory, com.google.gdata.client.AuthTokenFactory authTokenFactory)
public CalendarService(java.lang.String applicationName, java.lang.String protocol, java.lang.String domainName)
public java.lang.String getServiceVersion()
public static com.google.gdata.util.Version getVersion()
private void declareExtensions()
What I am doing wrong?
setUserCredentials
is inherited from GoogleService
, which CalendarService
is a subclass of.
However, you're looking at the 2.0 documentation, but you say you've downloaded the 1.0 client jar file. Perhaps that's the problem? From the gdata-java-client home page:
Where is Version 2 of the Google Data Java Client Library?
Users of the previous version 2.2 of the gdata-java-client library should be able to easily upgrade to google-api-java-client version 1.0. Thus, the new library should be backwards compatible with version 2.2 (with a few rare exceptions). Version 2 of the gdata-java-client won't be developed any further, and all ongoing development will instead now continue in the new project. Summary: same library, but with additional features, and a new name.
I suggest you either build from the source of 1.43 (which definitely does include setUserCredentials
) or start using the new project (which is admittedly still in alpha).
(Note: I work for Google, but this answer shouldn't be treated as being authoritatively "from" Google at all. I haven't had much to do with GData, and don't have any "inside information".)
精彩评论