1
votes

I go through 2 different Google Calendar code samples. After finished reading them, I am getting confused.

https://developers.google.com/google-apps/calendar/instantiate

  • They are using oAuth2?
  • They are using scope https://www.googleapis.com/auth/calendar. Is it because they are using oAuth2?
  • They required 2 API keys, clientId and clientSecret. Is it because they are using oAuth2?
  • They are using com.google.api.services.calendar.Calendar.

http://code.google.com/p/google-api-java-client/source/browse/calendar-android-sample/src/main/java/com/google/api/services/samples/calendar/android/CalendarSample.java?repo=samples

  • They are using ClientLogin?
  • The scope is cl? Is it because they are using ClientLogin?
  • They only require 1 simple API access key. Is it because they are using ClientLogin?
  • They are using com.google.api.services.calendar.model.Calendar. What is the difference with com.google.api.services.calendar.Calendar?

My target platform is on Android. Should I be using method from 1st example, or 2nd example?

1
If you check the homepage of the second example, the first thing I see is that they claim to use oAuth 2.0, the same as the first. - Nanne
@Nanne, I don't see any statement states that 2nd example is using oAuth 2.0. Can you point it out? - Cheok Yan Cheng
go to the homepage (code.google.com/p/google-api-java-client) of that project. Read the first line of tekst: Written by Google, this library is an easy-to-use and efficient Java client library for accessing Google APIs using JSON and **OAuth 2.0.** (emph mine) - Nanne
Confusing. But @sandis said 2nd example is ClientLogin? Can anyone confirm 2nd example is using oAuth 2.0 or ClientLogin? Thanks. - Cheok Yan Cheng
No, as far as I can see @sandis said that both oAuth and clientlogin work, there was no mention of what which example does. Anyway, the project itself says it uses oAuth, why doubt that? - Nanne

1 Answers

0
votes

The second example is using Android functionality of AccountManager which can access stored account information on an Android device. The AccountManager class will do the OAuth in the background, so that the developer doesn't need to. See previous question.