添加日历提醒

时间:2011-05-13 12:36:40

标签: android google-calendar-api

您好我正在使用以下代码将事件添加到Android的默认日历中。

  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", false);
    intent.putExtra("rrule", "FREQ=DAILY");
    intent.putExtra("endTime", cal.getTimeInMillis()+60*60*1000);
    intent.putExtra("title", "A Test Event from android app");
    intent.putExtra("description", "Who knows! this might work");
intent.putExtra("eventLocation", "Hope this time it works");
  intent.putExtra("hasAlarm", 1);
    startActivity(intent);

我的问题是,  如您所见,我使用了“FREQ = DAILY”,同样也有“FREQ = YEARLY”和“FREQ = MONTHLY”等值。 我想知道其他可用的替代方案,以便我可以在我的代码中提供它们。

1 个答案:

答案 0 :(得分:0)

喔。现在我明白了。我不得不将其添加到上面的代码中。

       ContentResolver cr = getContentResolver();
     Uri REMINDERS_URI = Uri.parse(getCalendarUriBase(this) + "reminders");
    values = new ContentValues();
    values.put( "event_id", Long.parseLong(event.getLastPathSegment()));
    values.put( "method", 1 );
    values.put( "minutes", 5 );
    cr.insert( REMINDERS_URI, values );
相关问题