Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use google calendar api in android?

Hi all I am new to android. I parsed the calendar file. I need to add events to Google calendar from my application. I am using eclipse ide. In eclipse how to use the Google calendar api? Any jar file is needed to use the calendar api?

like image 807
RSSS Avatar asked Jun 07 '10 07:06

RSSS


2 Answers

use this code:

Intent intent = new Intent(Intent.ACTION_EDIT);  
intent.setType("vnd.android.cursor.item/event");
intent.putExtra("title", "Some title");
intent.putExtra("description", "Some description");
intent.putExtra("beginTime", eventStartInMillis);
intent.putExtra("endTime", eventEndInMillis);
startActivity(intent);

also discussed here How to launch Android Calendar application using Intent (Froyo) Also, This might not work perfectly on some devices, such as the endTime wont work on HTC wildfire.

like image 183
Amol Gupta Avatar answered Oct 20 '22 20:10

Amol Gupta


As of ICS release there is an official API for managing calendar data: http://developer.android.com/reference/android/provider/CalendarContract.html

like image 27
Juri Avatar answered Oct 20 '22 20:10

Juri