The CommonsBlog


Random Musings on the Android 5.1 SDK

With each Android SDK 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. Android 5.1 is no exception, with its differences report available for analysis.

I always review this to see what’s different beyond the sorts of changes that get more disclosure.

Android 5.1 is tiny, in terms of updates. In fact, most of the API changes stem from one thing: making HttpClient officially deprecated. If you need to continue using the HttpClient API, consider switching to OkHttp and their HttpClient compatibility layer, or consider switching to Apache’s separate Android edition of HttpClient. Otherwise, switch to HttpURLConnection or OkHttp’s native API.

Beyond that, here are a few other tidbits that I found interesting:

  • The official multi-SIM support will be welcome, as that is a popular line of inquiry on Stack Overflow, given the prevalence of multi-SIM devices in various parts of the world.

  • One of my issues with Android itself was addressed, as boolean support was moved from Bundle to BaseBundle, making them available to PersistableBundle. Many thanks to whoever did that!

  • A new version of createChooser() on Intent was added, providing a hook to find out what the user chose in the chooser. This has been a popular question out on Stack Overflow.

  • Activity now has a getReferrer() method that will return a Uri identifying what app or Web page started this activity. Bear in mind that this may still return null, and the value can be spoofed, so do not rely upon this, particularly for any sort of security stuff.

  • We have a couple of new Settings action strings, to try to launch the battery-saver mode settings and the notification listener settings.

As I said, Android 5.1 is pretty small overall. That being said, these are generally welcome changes. And, I don’t have to race to push a book update out the door, which is always nice. :-)


Want an expert opinion on your Android app architecture decisions? Perhaps Mark Murphy can help!