0
我需要Android应用程序的帮助我想在日历中创建广告事件(而不是Google日历但不是可编辑的日历)不可编辑。android可以创建日历中不可编辑的事件吗?
现在我用这个代码来回创建事件和日历:
pushAppointmentsToCalender(this, "TITLE", "DESCRIPTION", "CITY", 1, MYDATE, false, false);
public static long pushAppointmentsToCalender(Activity curActivity, String title, String addInfo, String place, int status, long startDate, boolean needReminder, boolean needMailService) {
String eventUriString = "content://com.android.calendar/events";
ContentValues eventValues = new ContentValues();
eventValues.put("eventTimezone", TimeZone.getDefault().getID());
eventValues.put("calendar_id", 2); // id, We need to choose from
// our mobile for primary
// its 1
eventValues.put("title", title);
eventValues.put("description", addInfo);
eventValues.put("eventLocation", place);
eventValues.put("description", addInfo);
eventValues.put("eventLocation", place);
long endDate = startDate + 1000 * 60 * 60; // For next 1hr
eventValues.put("dtstart", startDate);
eventValues.put("dtend", endDate);
eventValues.put("guestsCanModify", 0);
eventValues.put("eventStatus", status); // This information is
Uri eventUri = curActivity.getApplicationContext().getContentResolver().insert(Uri.parse(eventUriString), eventValues);
long eventID = Long.parseLong(eventUri.getLastPathSegment());
return eventID;
}
此代码的工作,但如果我打开我的日历我可以修改的事件。
有一个类似的事件属性:eventIsEditable = False
?
这对发送垃圾邮件的日历来说非常合适。我希望这是不可能的。 – Henry
从facebook输入的日历事件不可编辑。很明显,你授权应用程序插入事件。 如何将代码插入到无法更改的事件? – Ray13