4
即時嘗試添加事件到Android日曆 這將同步這些事件automaticlly谷歌日曆 但它不工作! 事件添加manualy做同步,但事件添加從我的代碼,出現在日曆中,但不與谷歌日曆同步爲什麼?同步事件與谷歌日曆從Android
這是我的外接事件代碼
Calendar cal = Calendar.getInstance();
ContentValues event = new ContentValues();
event.put("calendar_id", 2); // 2 is the id of the google calendar in my phone
event.put("title", "Test Event2");
event.put("description", "Hiii Buddy");
long startTime = cal.getTimeInMillis();
long endTime = cal.getTimeInMillis() + 60 * 60 * 1000;
event.put("dtstart", startTime);
event.put("dtend", endTime);
event.put("allDay", 0);
event.put("eventStatus", 1);// tentative 0, confirmed 1 canceled 2
event.put("visibility", 3);// default 0 confidential 1 private 2
// public 3
event.put("transparency", 0);// opaque 0 transparent 1
event.put("hasAlarm", 1); // 0 false, 1 true
Uri eventsUri = getCalendarURI(true);
Uri url = getContentResolver().insert(eventsUri, event);
模擬器有可能嗎? –