我正在添加这样的事件......
public static String EVENT_URI = "content://com.android.calendar/events";
public static String CALENDAR_URI = "content://com.android.calendar/calendars";
public static Uri insert(ContentResolver cr, ContentValues cv) {
Uri newEvent = null;
try {
cv.put(Event.CALENDAR_ID, 1);
cv.put(Event.TITLE, "title");
cv.put(Event.DESCRIPTION, "description");
cv.put(Event.DTSTART, new Date().getTime());
cv.put(Event.DTEND, new Date().getTime() + 1000 * 60 * 60);
cv.put(Event.EVENT_LOCATION, "Hall: " + "+ 1000 * 60 * 60");
cv.put(Event.HAS_ALARM, true);
cv.put(Event.EVENT_TIMEZONE, TimeZone.getDefault().getDisplayName());
newEvent = cr.insert(Uri.parse(EVENT_URI), cv);
} catch (Exception e) {
e.printStackTrace();
}
return newEvent;
}
我想在添加活动后与Google日历同步,是否有任何参数我必须通过ContentValues
发送或我需要触发查询sync
。< / p>
这有用http://developer.android.com/guide/topics/providers/calendar-provider.html#sync-adapter
帮助!!感谢。
答案 0 :(得分:0)