A Calendar Service for Android

This project is a Calendar Service for Android and has been born since I was in need of a service which returned events from all the calendars embedded on an Android Smartphone in a specific timerange.

Hereby, the service basically returns a list which contains the id of a specific calendar and the events of the specific calendar.

You can either find the code repository on GitHub, or simply copy-paste the code below.

Please note that the repository is licensed under the Apache License, Version 2.0.

Basic use

Before going into too many details regarding the service itself, I will first of all show you how to use the library.

The code below essentially specifies how the library is intended to be taken into use:

As seen, the use of the service is quite basic and can be used for many different purposes such as returning a list of events upon clicking a button.

Although, the service may still not be working as expected, which can be due to missing permissions. For that reason, include the following snippet in AndroidManifest.XML:

By now, you should be able to access the calendars on the phone and read the events hereof.


Since that you by now understand the overall purpose of the service,  I will by now provide the actual implementation which consits of two classes:

  • The CalendarEvent class which is essentially an object of a calendar event
  • The CalendarService which creates a list of calendar events related to a specific calendar
    • If several calendars exist on the phone (which are not empty), the list will by then contain several calendar IDs which each will contain a list of calendar events

I will start of showing the most basic details, and go into the specifics as we move along.

The Calandar Object (CalendarEvent)

First of all, a Calendar Event (i.e. an object) basically contains the following information:

  • A title which contains the description of the event
  • The begin (start) date of the event which contains the day, the month, the date, the time, the timezone and the year
  • The end date of the event which contains the same information as above
  • Whether or not it is an all day event

The code of how a Calendar Event is implemented can be seen below:

The Calendar Service (CalendarService)

The specific implementation details of the Calendar Service itself is – in comparison with a Calendar Event as seen above – although much more difficult to explain in brief.

Although, the basic purpose is, that the Calendar Service provides a hash map where each Calendar ID (which contain events) is mapped with its Calendar Events.

Hereby, the implementation details are provided as a part of the source code itself in form of comments.


The Calendar Service has proven to provide the help which I required in form of retrieving all the events from different calendars in a specific time range.

Furthermore, the service itself can be used for a variety of purposes and can easily be expanded for future purposes.

Future Work

I have personally created this service based on my own needs, but I would not hesitate improving it.

If you hereby are in need of specific features, please let me know and I will adapt the service as soon as possible.

Thanks for any feedback in advance.


As stated in the CalendarServicethis repository has found inspiration from Akash Thakkar from Stackoverflow.

// David


Leave a Reply