The Blog

Add Events on Google Calendar on Android Froyo and above

09 Ago 10

Since i started developing applications for android i noticed there were some undocumented apis. Google does reccomend to not use these apis but since there are no “other nice ways” to achieve some tasks sometimes they are useful ( but still unreccomended)

It’s the case of the Google Calendar Apis. Out there you can find a lot of docs about these undocumented & unsupported apis but you’ll get some troubles if google decides to change them.

For example if you want to add an “event” to the calendar programmatically you can follow the snippet below which is SDK proof. In fact i did ( It’s not refactored for better reading ) write some code that would work on Sdk from 1.5 to 2.2 ( aka Froyo ) solving the provider issue on froyo and above.


Hope it helps to solve the problem about google calendar in froyo πŸ™‚

Reference to the CP: Xda

Comments

  • Andrea Baccega

    I’m not sure you can add a calendar easily. At least I don’t think you’ll be able to write a piece of code that just works on each android version.

    If you plan to release an app that just works on ICS or above you’ll need to take a look at the following link :Β http://android-developers.blogspot.it/2011/10/ics-and-non-public-apis.html

    Cheers πŸ™‚

  • Pingback: error while trying to insert new event to the calendar | PHP Developer Resource()

  • laxminarayana ch

    can anyone please send the working code for adding calendar events to my mail [email protected] i tried but it is not working

  • Andrea Baccega

    The code is fully working for me. Explain your issue otherwise we won’t be able to help.

  • Narayan

    hey ,

    if we add any event in android calendar with gmail id , so Β that event is show on google calendar ?Β 

  • Pradeep

    Please tell me that what is the _id and displayname in this line

    Β cursor = cr.query(Uri.parse(“content://calendar/calendars”), new String[]{ “_id”, “displayname” }, null, null, null);
    Β 

  • Bsrikanth88

    Nice code but it is not working on android 4.0 +. Please help me regarding this issue

  • Pingback: Google calendar: how to access it on android()