Mobile Working with the Android Calendar

Working with the Android Calendar

Introduction

Android handsets ship with a built-in Calendar application. Third-party applications can leverage the Calendar content provider interface to read user’s calendar information and schedule new events in the Calendar. This Calendar directly synchronizes with the user’s Google calendar.

Disclaimer

Unfortunately, there is no documentation for integrating with the Calendar application on Android as there is with other applications like the Contacts application. Instead, all information provided in this article was determined via reverse-engineering the Google Calendar content provider. This interface is subject to change and limited features are supported. However, Calendar integration can be a powerful feature for certain types of applications.

The code for this article was tested prior to the Android 2.0 SDK release. Since there are currently no Android 2.0 phones on the market, we cannot yet verify that this code works on the latest devices about to ship. We will post an update if there is a significant change. We did test this code on earlier devices like the T-Mobile G1 (SDK 1.6).

Accessing Calendar Data

In order to add Calendar support to your Android application, you must add the following permissions to your application’s AndroidManifest.xml file:

 

<uses-permission
android_name="android.permission.READ_CALENDAR">
</uses-permission>
<uses-permission
android_name="android.permission.WRITE_CALENDAR">
</uses-permission>

 

Registering these permissions allow you to access the user’s calendar data without having to deal with any Google login issues. The Calendar application is not installed on the Android emulator so all testing and development must be done with an actual device with the Calendar application installed (using the emulator will fail to launch the appropriate provider). The Calendar application and content provider are available on Android handsets with Google services, such as the T-Mobile G1.

 

Latest Posts

Related Stories