Pushpa Latha
Pushpa Latha

Reputation: 139

how to integrate google calendar in my android application?

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

Upvotes: 2

Views: 15299

Answers (2)

Nasrin
Nasrin

Reputation: 1

you can use google API For example, your hiking app could automatically add routes into a user's calendar. https://developers.google.com/google-apps/calendar.

Upvotes: 0

Saeid
Saeid

Reputation: 2321

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.

Upvotes: 1

Related Questions