I can set the event on the calendar on my device by using this 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);
Now it displays a popup screen so the user can decide to set this event or not, so are there any way to make it automatically ? i mean i can set this event or cancel it by programing, not by waiting the touch from user.
Like the way i set the alarm clock, after i startActivity(intent), it was set automatically (not display a popup alarm clock for setup).
u can add event on calendar using this code
UPDATE
Managed query is deprecated Now
Android 4.0 (API Level 14) added a
CalendarContractContentProvider.hope this helps