And Now, Your 'L' API Change WTFs
With each Android release, Google issues an API differences report, outlining things that were added, changed, or removed in a new API level compared to the previous one.
For whatever reason, the “L” Developer Preview’s differences report is published, along with the JavaDocs, in a poorly-structured ZIP archive.
I always review this to see what’s different beyond the sorts of changes that get more disclosure, coverage in Google I|O presentations, etc. And “L” has some significant changes.
NOTE: This analysis is based on the preview. It is entirely possible that some of the things in here will revert back to previous implementations by the time “L” ships as Android 5.0 (or whatever they call it). Hence, while this blog post represent areas of concern, be sure to double-check with the shipping version when it actually does ship.
NOTE #2: In Android, “deprecated” means “we think that there is a better solution, and we can’t guarantee that we will support what’s here indefinitely, but at the moment at least, it should work”.
Of note, with regressions bolded:
Action bar navigation, of all forms, is deprecated. This includes both action bar tabs and drop-down (“list”) navigation. It does not include the “custom view navigation” (e.g., browser address bar). I suppose the eliminates my concerns over the behavior of action bar tabs…
Part of the reason for this is that the action bar is being pulled out into something more readily manipulable by us developers.
setActionBar()method, taking a
Toolbarbasically looks like a simplified action bar and can be placed in arbitrary spots elsewhere in your view hierarchy, in contrast with the locked-to-the-top action bar.
Activities can be “persistable”, in that they “persist across reboots”. I am guessing that this is tied into the new extension of “recents” to include documents. As a side effect of this, we have new flavors of
onSaveInstanceState()and kin on
Activitythat allow us to populate both a
PersistableBundle, the latter of which presumably survives the reboot.
ActivityManagerare now deprecated and will return a reduced result set on L and higher devices.
BatteryManagernow gives us the ability to directly access battery information, without having to fuss with registering a
bindService()now requires an explicit
Intent, if your
targetSdkVersionis set to L or higher. I would consider using implicit
Intents here to be a code smell anyway, but if you are using them with your service, be forewarned. UPDATE: According to Alex Curran, this breaks the in-app purchasing (IAP) integration code.
We now have
getExternalMediaDirs(), which is a bit like
getExternalFileDirs(), but represent directories that will be scanned by the
A boatload of new stuff has been added to
DevicePolicyManagerfor those of you using the device admin APIs.
FragmentBreadCrumbsis now deprecated, for the six of you who were using that class. :-)
There is a new
LauncherAppsclass that helps simplify finding the relevant launchable activities. This is tied into the new managed profiles system.
MediaStorehas been augmented with
MediaStore.Audio.Radio. It is largely undocumented, and so it is unclear if this is referring to streaming radio stations, classic broadcast radio (e.g., FM), or something else.
Patternsare now deprecated, presumably reflecting the fact that the number of top-level domains is expanding rapidly.
Android now has some amount of tracking of “power save mode”, with an
ACTION_POWER_SAVE_MODE_CHANGEDbroadcast. Whether this is for OEM-specific modes or for some new common power save framework in Android, I cannot say.
In what might be a first, something was “undeprecated”, specifically
Settings.Secure, as it was moved back there from
WebSettingsnow lets you control mixed-content mode, referring to whether
WebViewshould load insecure content from a secure origin.
There are many other changes as well, particularly ones tied to “big ticket” changes in L, but these were ones that caught my eye.
Stuck on an Android problem? Subscribers have access to live office hours chats with Mark Murphy, to help you work through your challenges!