-1
我想爲我的日曆活動提醒。諮詢數量提醒日曆
這是我的事件代碼。
for (long gg=1;gg<=4;gg++)
{
long calID = gg;
long startMillis = 0;
long endMillis = 0;
Calendar cal = Calendar.getInstance();
MyDay = cal.get(Calendar.DAY_OF_MONTH);
MyMonth = cal.get(Calendar.MONTH);
MyYear = cal.get(Calendar.YEAR);
MyHoure = cal.get(Calendar.HOUR_OF_DAY);
MyMinute =cal.get(Calendar.MINUTE);
Calendar beginTime = Calendar.getInstance();
beginTime.set(MyYear, MyMonth, MyDay , MyHoure+1, MyMinute);
startMillis = beginTime.getTimeInMillis();
Calendar endTime = Calendar.getInstance();
endTime.set(MyYear, MyMonth, MyDay , MyHoure+1, MyMinute);
endMillis = endTime.getTimeInMillis();
ContentResolver cr = getContentResolver();
ContentValues values = new ContentValues();
values.put(Events.DTSTART, startMillis);
values.put(Events.DTEND, endMillis);
values.put(Events.TITLE, "Test Title");
values.put(Events.DESCRIPTION, "My Text ....." );
values.put(Events.CALENDAR_ID, calID);
values.put(Events.EVENT_TIMEZONE, "Israel/tel-aviv");
try{
Uri uri = cr.insert(Events.CONTENT_URI, values);
}
catch (Exception ex)
{
}
}
什麼我需要添加到我的代碼提醒在活動開始前10分鐘提醒?
我嘗試這樣:
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", 10);
cr.insert(REMINDERS_URI, values);
但它不工作。
感謝
什麼阻止你這樣做? – Leo 2014-10-07 06:40:44
我更新我的問題 – GoldSoft 2014-10-07 06:43:50