Showing posts with label errata. Show all posts
Showing posts with label errata. Show all posts

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. 


Tuesday, January 18, 2011

Phrasebook Map Intents: Redux

Maps 5.0 at 1024x600 (click)
Zoomed all the way out at z=2
As part of a review of some of our applications we've created as part of articles, we revisited the Phrasebook app found on Google Code. Written with Android 2.2 in mind, the application still runs fine on both Android 2.3 and with Tablet displays (e.g. 1024x600).

However, one strange issue did come up: the geo URLs for the addition of launching maps from Android SDK Quick Tip: Launching Maps In-App don't all work as expected with Maps 5.0. The default one, the world link, used:

geo:0,180?z=1

Sending this actually causes Maps 5.0 to crash. It works fine in Maps 4.2 and 4.7 (available in Emulator 2.2 and 2.3, respectively). The fix? Change z to 2. This is odd, because 1 is documented by Google to show the whole world. (Though, there is a note that the geo URI is still under development. The linked-to document is from 2007, though.) We clearly see in the above screenshot that there are no levels of zoom farther out now.

Next, we wanted to test the rest of the queries to see if any others were affected. Here they are, and the results:

"geo:0,0?q=Belgium": Success
"google.streetview:cbll=46.813812,-71.207378&cbp=1,99.56,,1,-5.27&mz=21": Success
"geo:0,0?q=Matterhorn&z=8": Success
"geo:0,0?q=Coffee Shops near Paris, France":Success

So, it's reasonable to expect the only thing to now avoid are zoom levels of 1. The fix has been pushed up to the repository.

This experience is a great example of the sort of maintenance applications can take. Not only should they be tested on devices with new firmware and SDK versions, but any other applications that they rely on also need to be updated and tested against. Maps 5.0 is not yet found within an emulator, so this testing requires a handset with Maps 5.0 on it.