Apps Developer Blog

Information for Google Apps Developers

Building a Meeting Scheduler for Android using the new Calendar API

December 21, 2011
Share on Google+ Share on Twitter Share on Facebook
Google
Labels: Android , Google Calendar API

4 comments :

fedex1 said...

This is very helpful. Thanks Alain.

I've compiled and installed and it works nicely. I happen to have 1600 contacts so it is very slow loading the contacts. And it seems to load them every time. I placed a limit 500 on the contact query and it loads in about 11 seconds. This is on a nexus s running ice cream sandwich.

December 23, 2011 at 10:37 AM
Alain said...

Hello,

Thanks for your comment! I would be happy to add optimization in the contacts loading, especially if you can help me with a patch :).

Best,
Alain

December 27, 2011 at 8:56 AM
Ralph Yozzo said...

Hi Alain,

My forked version is here: http://code.google.com/r/fedex1-google-meeting-scheduler/

Another question:

I'd like to use the same approach that you use to add a calendar to the list of subscribed calendars for the user. For example, let's say there is a series of events that users want to know about but do not want to maintain themselves. (maybe a running event schedule or a holiday schedule)

I'd like to use this code to subscribe the user to a public google calendar that I maintain:

com.google.api.services.calendar.model.Calendar newCalendar = new com.google.api.services.calendar.model.Calendar();
//newCalendar.set(CalendarContract.Calendars.ACCOUNT_NAME, "[email protected]");
newCalendar.set(CalendarContract.Calendars.ACCOUNT_NAME, "[email protected]");
newCalendar.set(CalendarContract.Calendars.ACCOUNT_TYPE, "com.google");

newCalendar.set(CalendarContract.Calendars.NAME, "[email protected]");
newCalendar.set(CalendarContract.Calendars.CALENDAR_DISPLAY_NAME, "[email protected]");

newCalendar.set(CalendarContract.Calendars.CALENDAR_COLOR, -13671671);

newCalendar.set(CalendarContract.Calendars.CALENDAR_ACCESS_LEVEL, 200);
newCalendar.set(CalendarContract.Calendars.OWNER_ACCOUNT, "[email protected]");
newCalendar.set(CalendarContract.Calendars.SYNC_EVENTS, 1);
newCalendar.set(CalendarContract.Calendars.CALENDAR_TIME_ZONE, "America/New_York");

newCalendar.set(CalendarContract.Calendars.VISIBLE, 1);
//newCalendar.set(CalendarContract.CALLER_IS_SYNCADAPTER, true);
Log.d(Constants.TAG, "insert calendar BEGIN");
try {
service.calendars().insert( newCalendar).execute();
} catch (Exception e) {
Log.d(Constants.TAG, "ISSUE: insert calendar END");
e.printStackTrace();

}
Log.d(Constants.TAG, "insert calendar END");

But it fails with this error:

D/Meeting Scheduler(13795): insert calendar BEGIN
D/Meeting Scheduler(13795): ISSUE: insert calendar END
W/System.err(13795): com.google.api.client.googleapis.json.GoogleJsonResponseException: 400 Bad Request
W/System.err(13795): {
W/System.err(13795): "code" : 400,
W/System.err(13795): "errors" : [ {
W/System.err(13795): "domain" : "global",
W/System.err(13795): "message" : "Required",
W/System.err(13795): "reason" : "required"
W/System.err(13795): } ],
W/System.err(13795): "message" : "Required"
W/System.err(13795): }
W/System.err(13795): at com.google.api.client.googleapis.services.GoogleClient.execute(GoogleClient.java:123)
W/System.err(13795): at com.google.api.client.http.json.JsonHttpRequest.executeUnparsed(JsonHttpRequest.java:67)
W/System.err(13795): at com.google.api.services.calendar.Calendar$Calendars$Insert.execute(Calendar.java:1226)
W/System.err(13795): at com.google.samples.meetingscheduler.activity.CreateEventActivity$2.run(CreateEventActivity.java:206)
W/System.err(13795): at java.lang.Thread.run(Thread.java:856)
D/Meeting Scheduler(13795): insert calendar END

January 23, 2012 at 11:45 AM
devbond said...

worked perfectly fine ,but after a few trials it stopped working says failed to create meeting,usage limts,error code 400...please help

March 27, 2012 at 12:06 AM

Post a Comment

  

Labels


  • .NET 3
  • #io15 1
  • Administrative APIs 26
  • Admin SDK 4
  • AdSense 1
  • analytics 4
  • Android 5
  • App Engine 5
  • Apps Script 98
  • Auth 1
  • billing 4
  • Charts 1
  • Chrome OS 1
  • classroom 1
  • Cloud Storage API 1
  • Community 1
  • Developers 5
  • Directory API 1
  • Drive 2
  • Drive SDK 38
  • execution API 1
  • Firebase 1
  • Freemium 1
  • Fusion Tables 2
  • Gadgets 5
  • Gmail APIs 16
  • Google+ 3
  • Google APIs 3
  • Google Apps 3
  • Google Apps Directory API 1
  • Google Apps Marketplace 3
  • Google Apps Script 1
  • Google Calendar API 20
  • Google Contacts API 3
  • Google Data Protocol 7
  • google docs 3
  • Google Docs API 20
  • Google Drive 2
  • Google Forms 4
  • Google I/O 3
  • googlenew 1
  • Google Prediction API 3
  • Google Profiles API 2
  • Google sheets 2
  • Google Sites API 4
  • Google Spreadsheets API 4
  • Google Talk 1
  • Google Tasks API 6
  • Groups 2
  • Guest Post 42
  • ISVs 2
  • java 1
  • JavaScript 3
  • marketing 3
  • Marketplace 47
  • Marketplace ISV Guest 21
  • Migration 1
  • Mobile 1
  • mpstaffpick 1
  • oauth 11
  • OpenID 7
  • PHP 1
  • python 4
  • realtime API 1
  • Resellers 2
  • Ruby 1
  • SaaS 1
  • security 1
  • Staff Picks 2
  • webinar 2


Archive


  •     2015
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
  •     2014
    • Dec
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Mar
    • Feb
    • Jan
  •     2013
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2012
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2011
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb
    • Jan
  •     2010
    • Dec
    • Nov
    • Oct
    • Sep
    • Aug
    • Jul
    • Jun
    • May
    • Apr
    • Mar
    • Feb

Feed

Company-wide

  • Official Google Blog
  • Public Policy Blog
  • Student Blog

Products

  • Android Blog
  • Chrome Blog
  • Lat Long Blog

Developers

  • Developers Blog
  • Ads Developer Blog
  • Android Developers Blog
  • Google
  • Privacy
  • Terms