How to view a public Google Calendar via an Android Application

前端 未结 2 1968
独厮守ぢ
独厮守ぢ 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<Event> 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.

    0 讨论(0)
  • 2021-01-02 12:25

    If you are looking to integrate the public Google Calendar (www.google.com/calendar) with your Android Application, you have to use the Google Calendar API.

    The easiest method would be download the Google Calendar Client Library from here and then use the API Reference here. In the Client Library Page, you want to download "Google APIs Client Library for Java (rc)" package to integrate into your Android App.

    You will first need to go to API Console to create an App with Calendar API Access .

    If you do not want to use the native library, you can even do it using REST API (use HTTP GET & POST Commands), example App here

    Hope this helps.

    0 讨论(0)
提交回复
热议问题