【问题标题】:sync event with google calendar from android从 android 与谷歌日历同步事件
【发布时间】:2012-02-16 08:36:50
【问题描述】:

我正在尝试将事件添加到 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);

【问题讨论】:

    标签: android android-layout android-emulator android-intent google-calendar-api


    【解决方案1】:

    您必须在以下位置启用同步:设置 -> 帐户和同步 -> 管理帐户 -> 同步日历
    在日历应用程序中:菜单 -> 更多 -> 日历,您必须将您的 Google 帐户设置为“已同步”。

    【讨论】:

    • 模拟器有没有可能?
    猜你喜欢
    • 1970-01-01
    • 2017-10-12
    • 2011-01-31
    • 2023-03-16
    • 1970-01-01
    • 2014-01-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多