How to view a public Google Calendar via an Android Application

前端 未结 2 1984
独厮守ぢ
独厮守ぢ 2021-01-02 11:21

I must\'ve gone through ever Stack Overflow question based on the Google Calendar so far with no luck what so ever. I\'ve been trying this for hours now and got little to no

2条回答
  •  攒了一身酷
    2021-01-02 12:01

    For anybody that has followed the Android Developer API example, but still can't find how to add a public calendar. Try out

    CalendarListEntry gracieCal = new CalendarListEntry();
    gracieCal.setId("your-public-calendar-id");
    mService.calendarList().insert(gracieCal);
    
    Events events = mService.events().list(gracieCal.getId())
                    .setMaxResults(10)
                    .setTimeMin(new DateTime(System.currentTimeMillis()))
                    .setOrderBy("startTime")
                    .setSingleEvents(true)
                    .execute();
    List items = events.getItems();
    

    'mService' is the com.google.api.services.calendar.Calendar instance that you should have already created. (see the api tutorials mentioned by the other answer)

    'your-public-calendar-id' can be found in the settings for your public google calendar.

提交回复
热议问题