Sunday, December 4, 2011

Errata for "Introducing Android Development with Ice Cream Sandwich"

We recently completed a very short, very small book project: "Introducing Android Development with Ice Cream Sandwich." It's a minibook that was targeted to release with Ice Cream Sandwich. As such, the testing and development timeline was incredibly short and truncated, and devices are still not available to everyone who wants them worldwide.

Right off, we've had a reader point out one issue:

In Chapter 1, when adding the code to play an audio file from a remote URL, Android 4 (Ice Cream Sandwich) now requires and enforces the Internet permission. We've tested on previous SDK versions and, indeed, this permission was not enforced on any prior platform versions. In this case, we completely agree that it should have been -- the sample application has been using Internet data without needing to request a permission since Android 1.0-but now it needs this permission.

Luckily, the LogCat output makes this crystal clear:

12-04 15:08:15.674: D/MediaPlayer(605): Couldn't open file on client side, trying server side
12-04 15:08:15.684: W/ServiceManager(36): Permission failure: android.permission.INTERNET from uid=10044 pid=605
12-04 15:08:15.684: E/MediaPlayerService(36): Request requires android.permission.INTERNET
12-04 15:08:15.684: E/MediaPlayer(605): Unable to to create media player

The Android documentation has been updated to state, at the class level, that MediaPlayer requires the INTERNET permission when used with network based content. As it should. What isn't stated is if older SDKs will eventually be updated to enforce this permission or not. Right now, we only see this permission being enforced when running the application on API Level 14, which, right now, is less than 1% of all devices in the field. 

We apologize for any inconvenience or confusion this issue has caused. The update will also be applied to the full book, Android Wireless Application Development: Volume 1: Android Essentials: Third Edition (or, as we like to call it, AWAD3EV1). We will also update the code available on this website to reflect the permission policy change. 

1 comment:

Patrick said...

I noticed this - thx for a quick response - sorry, I bellyached in my post - I was irritable because it took me a while to figure it out - I will email for help sooner if I get stuck again