512 CHAPTER 14: Android Content Providers: Providing Data to Applications
Deprecation is a common programming situation that developers need to get used to. Hence,
I am covering it here, so that as an Absolute Beginner, you can learn all about it now, and not be
blind-sided by this advanced programming and application development concept later on down
the line.
With Android, deprecation is especially prevalent, as different OS versions will feature different
support for the hardware features that manufacturers add to their new smartphones, iTV sets,
smartwatches, eBook readers, and tablets. These require new APIs, or changing the existing APIs,
in order to support these new hardware features.
For instance, Android 1.5 was initially designed for use on smartphones. Android added touchscreen
gestures in Android version 1.6, and camera support in version 2.0. Next, tablets and eReaders
came along, and Android 3.0 added feature support for large screen consumer electronics devices.
Later, iTV sets came out, and so Android version 4.0 added GoogleTV support and the TVDPI
constant for 1280 by 720p resolutions was added to the API. Next, Android game consoles, such as
the nVidia Shield, came out, and faster screen refresh (60FPS) was added to Android 4.1. Likewise,
faster touchscreen refresh (60FPS) was added to Android 4.2.
Recently, smartwatches and smartglasses have become popular, and so the faster Bluetooth 4.0
standard support was added into Android 4.3 and 4.4. Android 5.0 will feature new API additions
that allow physical fitness hardware to be utilized with the Android OS, and so the version
enhancements will go on and on, driven by the Android hardware manufacturers, which now number
in the hundreds internationally, because Android is an “open” operating system platform.
Note Over time, version functionality gets more and more difficult to keep track of. Indeed, Android already
has nineteen different OS versions (API Levels) that your code must work across. Keeping track of all the
current programming constructs, database structures, and logic mazes is enough of a challenge for most,
without the layer on top that involves remembering which Java constructs and interfaces work, or do not
work, with any given OS version. This is one of the primary reasons that Android programmers are so well
compensated.
Table 14-2 lists some of the content providers that are compatible with the new Android versions
(2.1 through 4.4) and that are used for manipulating contact information. A vastly different content
provider database structure approach solidified in API Level 8 and beyond may well be the primary
reason that the defaults in the New Android Application Project dialog (shown in Figure 3-3 in
Chapter 3) suggests (that is, defaults to) API Level 8 through 19 support.