how to integrate google calendar in my android application?

13,782

If you want to use Calendar in your app directly, you can use this GitHub Library that offers a lot of customization:

  1. Caldroid
  2. Android-Week-View

But if you wish to use Calendar, you should work with these intents:

Try this in your code:

Calendar cal = Calendar.getInstance();              
Intent intent = new Intent(Intent.ACTION_EDIT);
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("beginTime", cal.getTimeInMillis());
intent.putExtra("allDay", true);
intent.putExtra("rrule", "FREQ=YEARLY");
intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
intent.putExtra("title", "A Test Event from android app");
startActivity(intent);

Add permission..

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"...>
    <uses-sdk android:minSdkVersion="14" />
    <uses-permission android:name="android.permission.READ_CALENDAR" />
    <uses-permission android:name="android.permission.WRITE_CALENDAR" />
    ...
</manifest>

As for the Google Calendar access, the best way is to use the Google Calendar API.

Share:
13,782

Related videos on Youtube

Pushpa Latha
Author by

Pushpa Latha

Updated on June 14, 2022

Comments

  • Pushpa Latha
    Pushpa Latha about 2 years

    I am trying to integrate google calendar in my app to add my events to google calendar but i do not know how to integrate. please any one could you help me Thanks in advance

    • Ravindra Kushwaha
      Ravindra Kushwaha over 8 years
      please chck my edited solution...it can be helpful for..let me know in case of concern
    • Pushpa Latha
      Pushpa Latha over 8 years
      Sir my requirement is ,i need to add date and the event to google calendar api , after that i need to get notification from google calendar api . so can i do it with that help ? –
    • Dhinakaran Thennarasu
      Dhinakaran Thennarasu over 8 years
    • Pushpa Latha
      Pushpa Latha over 8 years
      i was followed this developers.google.com/google-apps/calendar/quickstart/androi‌​d . but i did not get any results