无法禁用日历活动的提醒

时间:2014-06-30 10:38:09

标签: android calendar google-calendar-api reminders

我想要一个没有提醒的日历活动。我有以下代码:

private void addToCalendar(Context ctx, String missedCallName,
        String phoneNumber, int missedCallImportance, long startTime,
        long endTime, SharedPreferences sp) {
    ContentResolver cr = ctx.getContentResolver();
    ContentValues values = new ContentValues();

    long realStartTime = 0;

    if (missedCallImportance == MOST_IMPORTANT_CONTACT) {
        realStartTime = startTime
                + mins(NEEDED_MINS_BEFORE_AND_AFTER_CALLS);
        values.put(CalendarContract.Events.DTSTART, realStartTime);
        values.put(CalendarContract.Events.DURATION, "+P"
                + NEEDED_MINS_FOR_IMPORTANT_CALLS + "M");

    }
    // ki kell hagyni egy helyet a fontos kontaktnak
    else {
        realStartTime = startTime + mins(NEEDED_MINS_FOR_IMPORTANT_CALLS);
        values.put(CalendarContract.Events.DTSTART, realStartTime);
        values.put(CalendarContract.Events.DURATION, "+P"
                + NEEDED_MINS_FOR_OTHER_CALLS + "M");

    }

    values.put(CalendarContract.Events.TITLE, "Call " + missedCallName);
    values.put(CalendarContract.Events.DESCRIPTION, "Phone number: "
            + phoneNumber);

    TimeZone timeZone = TimeZone.getDefault();
    values.put(CalendarContract.Events.EVENT_TIMEZONE, timeZone.getID());

    // values.put(CalendarContract.Events.HAS_ALARM, false);
    values.put(CalendarContract.Events.HAS_ALARM, 0);

    // default calendar
    values.put(CalendarContract.Events.CALENDAR_ID, 1);

    // insert event to calendar
    Uri uri = cr.insert(CalendarContract.Events.CONTENT_URI, values);

}

问题: 有时(可能每隔2次)会在日历中提醒事件...(提醒和电子邮件提醒)

我做错了什么?我不想要任何提醒!

1 个答案:

答案 0 :(得分:0)

这是因为默认的Google日历设置......