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