The following is the first few sections of a chapter from The Busy Coder's Guide to Android Development, plus headings for the remaining major sections, to give you an idea about the content of the chapter.
The Android Open Source Project (AOSP) has had a Calendar application from its earliest days. This application originally was designed to sync with Google Calendar, later extended to other sync sources, such as Microsoft’s Exchange. However, this application was not part of the Android SDK, so there was no way to access it from your Android application.
At least, no officially documented and supported way.
Many developers poked through the AOSP source code and found that the
Calendar application had a
ContentProvider. Moreover, this
ContentProvider was exported (by default). So many developers used
undocumented and unsupported means for accessing calendar
information. This occasionally broke, as Google modified the Calendar
app and changed these pseudo-external interfaces.
Android 4.0 added official SDK support for interacting with the
Calendar application via its
ContentProvider. As part of the SDK,
these new interfaces should be fairly stable — if nothing else,
they should be supported indefinitely, even if new and improved
interfaces are added sometime in the future. So, if you want to tie
into the user’s calendars, you can. Bear in mind, though, that the
ContentProvider is not identical to the
older undocumented providers, so if you are aiming to support pre-4.0
devices, you have some more work to do.
Of course, similar to the
ContentProvider is severely lacking in
documentation, and anything not documented is subject to change.
Understanding this chapter requires that you have read the chapters on:
While the Android emulator has the
ContentProvider, it will do you little good. While you can define a
Google account on the emulator, the emulator lacks any ability to
sync content with that account. Hence, you cannot see any events for
your calendars in the Calendar app, and you cannot access any
calendar data via
You may be able to use an
to sync with an Outlook calendar.
Otherwise, in order to test your use of
you will need to have hardware that runs Android 4.0 (or higher),
with one or more accounts set up that have calendar data.
The preview of this section was lost due to a rupture in the space-time continuum.
The preview of this section is off trying to sweet-talk the Khaleesi into providing us with a dragon.