How to read google calendar events in android?

前端 未结 2 1408
一整个雨季
一整个雨季 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<Calendar> calendars = calendarProvider.getCalendars().getList();
    

    Or, get all Events of specific calendar:

    List<Event> 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 :)

    0 讨论(0)
  • 2021-02-07 15:35

    You can read this page. It is written that how you can get the calendar information.

    Speaking simply,

    1. get the account logged in the android device. (return object is Account.)
    2. get the calendar list the specific has.
    3. get the events in the range of the particular time. (it is for one calendar.)
    4. repeat 3 for all calendars.
    0 讨论(0)
提交回复
热议问题