How to read google calendar events in android?

前端 未结 2 1410
一整个雨季
一整个雨季 2021-02-07 15:05

I am reading all the android calendar events and it is working fine by using this below code but, I want to fetch all the google calendar events from user mail accounts .How can

2条回答
  •  灰色年华
    2021-02-07 15:20

    This post is a little bit old, but here is another easy solution for getting data related to Calendar content provider in Android:

    Use this lib: https://github.com/EverythingMe/easy-content-providers

    And now, get all calendars:

    CalendarProvider calendarProvider = new CalendarProvider(context);
    List calendars = calendarProvider.getCalendars().getList();
    

    Or, get all Events of specific calendar:

    List calendars = calendarProvider.getEvents(calendar.id).getList();
    

    And there is also option to get Reminders, Attendees, Instances.

    It works with lists or cursor and there a sample app to see how it looks and works. In fact, there is support for all Android content providers like: Contacts, SMS, Calls, ... Full doc with all options: https://github.com/EverythingMe/easy-content-providers/wiki/Android-providers

    Hope it helped :)

提交回复
热议问题