首页 文章

Google日历:在我的Google帐户中同步最近创建的日历

提问于
浏览
0

我刚刚在Scala Webframework中使用了Google Calendar Java API,并设法以编程方式创建新日历 . 之后,我在该日历中创建了一个新事件 .

我的问题是,新日历中的事件似乎与我的客户端设备(我的平板电脑)没有同步 . 但是,如果我在“主要”日历中创建活动,我会立即在所有设备上看到该活动 .

如果我转到https://www.google.com/calendar/syncselect,则会检查最近创建的日历 . 所以实际上我希望所有事件都能在我的设备上同步 .

我在Scala上下文中使用JAVA API:

def addCalendar(serviceCalendar: com.google.api.services.calendar.Calendar): com.google.api.services.calendar.model.Calendar = {

    val calendar = new Calendar()
    calendar.setSummary("test calendar")
    serviceCalendar.calendars().insert(calendar).execute()
  }
 //...



 //code fragment where a new event is inserted into an existing calendar
 val credential = new GoogleCredential().setAccessToken(token.get.value)
 val calendar = Auth.getCalendarService(credential)
 //create a new test calendar
 val testCalendar = addCalendar(calendar)
 val event = createEvent

 //insert new event into "primary" calendar.
 calendar.events().insert("primary", event).execute()
 //insert event into the new calendar
 calendar.events().insert(testCalendar.getId(), event).execute()

这两个事件都会显示在Google日历网络界面中 . 但是,只会同步“主”日历中的事件 .

如果我查看我的Android(Samsung S Planner,Android 4.3 . )应用程序的“日历列表”,我不会将最近创建的日历视为“同步” . (主日历标记为同步!) .

所以我想这就是为什么我看到“主要事件”而不是另一个事件的原因 . 但实际上我希望Google发送某种推送通知,告知新帐户已添加到该帐户 .

我可以以编程方式强制执行吗?或者仅仅是时间问题?

1 回答

  • 1

    Syncselect仅影响iCalendar,iOS和其他CalDAV客户端 . 它不适用于Android . 在那里,日历同步的切换在设备上,AFAIK需要手动完成 .

相关问题