A (175)

(Tuis.) #1

510 CHAPTER 14: Android Content Providers: Providing Data to Applications


Android Built-in Content Providers


A significant number of SQLite-based database structures are “hard-coded” into the Android OS,
so that users of Android devices can handle things that they expect from a phone, iTV set, e-Reader,
smartwatch, or tablet. These include contact directories, address books, calendars, camera picture
storage, digital video storage, music albums, phone books, and so forth.


The most extensive of the SQLite database structures is the Contacts database, which contains
many different tables (essentially acting as sub-databases) containing personal information, such
as contact names, phone numbers, emails, preferences, social media settings, and so forth. These
structures are very complex, and since this book is focused on programming for Absolute Beginners,
and not database theory, you will be working with the primary contact name database, to keep it
more about Java programming and Android Content Providers, rather than about database structure
and theory.


The base-level interfaces of the android.provider package allow you to access those data
structures that define the setup and personalization of each user’s Android device hardware.
Obviously, the data in each of these data structures will be completely different for each user’s
smartphone, smartwatch, tablet, phablet, e-Reader, or iTV Set.


Android 1.5 Contacts Database Contact Provider


Table 14-1 lists the now deprecated Contacts database interfaces for Android 1.5, 1.6, or 2.0, which
can be found on the Android Developer site. Deprecated, in this case, means that this Contacts
database has been replaced with a more modern ContactsContract database structure. However,
the Contacts database structure is still valid, and will work just fine for those users who are still using
Android OS versions 1.5, 1.6, or 2.0.


Table 14-1. The Contacts database and its data table interfaces to be used for Android 1.5, 1.6 or 2.0 support
Database.Table Contents Held in this Database Table Structure
Contacts.OrganizationColumns Organization
Contacts.GroupsColumns Groups
Contacts.PeopleColumns People
Contacts.PhonesColumns Phone numbers
Contacts.PhotosColumns Contact photographs
Contacts.PresenceColumns IM presences
Contacts.SettingsColumns Phone settings
Contacts.ContactMethodsColumns Contact methods
Contacts.ExtensionsColumns Phone extensions

The Contacts DBMS structure, shown in Table 14-1, was redone from scratch in Android 2.1. You
will be taking a look at how the structure increased in complexity next.

Free download pdf