Forgot your password?
typodupeerror
Image

Unlocking Android 117

Posted by samzenpus
from the read-all-about-it dept.
Michael J. Ross writes "Of all the potential challengers to Apple's phenomenally popular iPhone, perhaps the one with the best prospects is Google's Android, which is not a mobile phone per se, but rather an open-source platform that the company encourages phone manufacturers to deploy in their own products. Similarly, Google encourages computer programmers to develop applications for the Android environment. But learning how to create such applications is daunting to the uninitiated, particularly for developers who have never before worked with the user interface controls, Web services, and other resources involved. A recently published book, Unlocking Android, is designed to help such developers." Read below for the rest of Michael's review.
Unlocking Android
author W. Frank Ableson, Charlie Collins, Robi Sen
pages 416 pages
publisher Manning Publications
rating 8/10
reviewer Michael J. Ross
ISBN 978-1933988672
summary A guide to developing applications for Google's Android.
Unlocking Android was put out by Manning Publications on 28 May 2009, under the ISBN 978-1933988672. It was authored by W. Frank Ableson, Charlie Collins, and Robi Sen — all of whom have extensive experience in developing mobile software applications. The publisher's Web page makes available author biographies, descriptions of the book, all its ancillary parts (the foreword, preface, acknowledgments, table of contents, and index), a white paper on Android (oddly termed a "green paper"), and two sample chapters ("Targeting Android" and "Intents and services"). There is a link to download the source code from the Google Code site, organized by chapter. The Manning site also hosts a forum, where readers and the authors can discuss the book. As of this writing, there are 42 threads, comprising 120 messages. Lastly, the site has links to order both the print and electronic versions of the book. Note that purchasing the former automatically entitles one to a copy of the latter. Manning appears to be pioneering this approach to making e-books more readily available to customers, since every print copy now contains an insert with a list of codes that can be used to download a PDF copy of the book.

The book is ostensibly intended for Android beginners, even though it does contain enough detailed information to serve as a partial reference for more experienced developers. It is organized in a logical fashion, in three parts, starting with an overview of Android itself, both the technology and the organization behind it. Then the reader is introduced to the Android programming environment, along with its many components and capabilities. The book concludes with tutorial chapters that step the reader through creating a sample Android application and more. The material covers Android SDK 1.x. Since Android programs are written in Java, any reader fluent in that language will have a much easier time absorbing the ideas. However, the authors state that even non-Java programmers should be able to follow the examples, as long as they have knowledge of similar languages, such as C, C++, or C#. However, even a cursory glance at the code, by such a reader, would prove that Java knowledge is essential.

The first chapter — oddly named "Targeting Android" — introduces the platform, the organizations behind it, the mobile market as a whole, Android's features, how it differs from featured phones and smartphones, its open-source licenses, platform components, libraries, service managers, programming environment, and virtual terminal. Be warned that Figure 1.1 could be confusing to some readers, because it shows the layers of technology that compose the Android platform, but pictures them on the front of a mobile phone, showing a keypad, which makes the layers appear to be part of the actual user interface; the phone should be removed from the illustration, in a future edition. The chapter goes on to discuss booting and activating Android, as well as how to map applications to processes. Some readers anxious to get to the technical nitty-gritty, may become impatient when reading the first portion of this chapter, because it largely consists of introductory material. Yet this context can be helpful and interesting to people unfamiliar with the mobile phone market. (Articles and tutorials aimed at new mobile application developers, oftentimes assume that said developers are already extremely familiar with the rapidly changing mobile market.) In the later portion of the chapter, readers are shown a handful of code snippets, with some explanation as to what they are doing and how. In reading this material, the reader could be easily overwhelmed with all of the new terminology. One can only hope that the authors were not thinking that the typical reader would understand all of what is discussed, or be able to do anything with it. A canonical "Hello, world" program or something similar — with an explanation as to how to execute it — would have been a far more gentle introduction. By the way, the first few code snippets are poorly indented, and some of the method names are italicized, while others are not — with no mention as to what this might signify, either in the chapter or in the earlier "Code Conventions" section.

In Chapter 2, the reader is introduced to the key tools for basic Android development, including the SDK, Eclipse, and the Android Emulator. An example application — a tip calculator — is developed, step by step, to illustrate those tools. Clearly, this tutorial information should have been presented before the second section of the previous chapter. It nonetheless serves as a valuable introduction to programming Android. Incidentally, Figure 2.1 labels the development environment as being located on a laptop, incorrectly suggesting that desktop computers are not equally usable platforms. Later, when the authors suggest that readers add the Android SDK tools directory to their system search path, they specify only the release-independent directory (containing adb, for instance), and not the release-specific paths (containing aapt, which is the first tool discussed); readers presumably should add both. Also, the authors should specify which release to use, 1.1 or 1.5. The reader eventually is told how to run a sample application — and not a moment too soon, because at that point the reader is already 15 percent of the way into the book. To reach that point, she must wade through more introductory material than was needed, in addition to discussions of network speed and latency, command line tools, DDMS, Java packages, and other information. All of this could and should be covered later, when it would be much more meaningful, and the reader would have greater motivation to learn it, having seen an Android application running (if only in the emulator).

Part 2 forms the bulk of the book, consisting of nine chapters devoted to the essential aspects of Android application development: user interfaces, including the Activity class, views, resource types, and manifest files; Intent classes, broadcast receivers, task services, and inter-process communications; data storage and retrieval, including user preferences, files stored on the local system and on SD cards, databases, and the ContentProvider class; networking, including client/server interaction, HTTP, and Web services such as SOAP; telephony, including how to receive and initiate calls and SMS messages; notifications and alarms; generating graphics and animation; multimedia, including audio and video, utilizing the OpenCORE technology; location-based applications, using a variety of tools, including Google Earth's KML. All of these chapters make use of example applications, with annotated source code and screenshots of the applications running in the Android emulator.

The third and final part of the book comprises two chapters, each of which extends the core concepts of Android development. Chapter 12 steps the reader through the creation of a substantial application, named "Field Service Application," designed for mobile technicians who provide support services for customers of contracted clients. The application is designed to be used by both the technician and his home office to assign and manage job orders, capture customer signatures of completed jobs, order replacement parts, and receive navigation assistance. The final chapter, "Hacking Android," explores Android's utilization of Linux, the C programming language, and the SQLite database — as well as how the Android developer can access these capabilities under the hood.

Appendix A explains how to install the Eclipse integrated development environment (IDE), the Android software development kit (SDK), and the ADT plug-in for Eclipse. Readers who do not already have those components installed on their computers, may want to first read the appendix and follow the procedures. Note, however, that the procedures given in section A.4, for installing the ADT plug-in, are already out of date — namely, for Eclipse version 3.3. In addition, the URL given by the authors ("https://dl-sll.google.com/android/eclipse") is invalid, because it is missing the trailing directory slash, which is necessary for it to work within Eclipse. (This points up the importance of including root directories in URLs, despite their common absence, because even though Web browsers will automatically correct this upon receiving an error message from the server, Eclipse evidently does not.) The online Android installation instructions are much more useful, because they also include the latest version of Eclipse, 3.4.

As is to be expected with the first edition of any detailed computer programming book, this one contains some errata — for instance, in the first portion of the book alone: "Android[']s" (page xxii, twice), "Webkit" (page 7, in the caption), "SQLite[,] an" (page 11), and "byte code[s]" (page 13). Also, terms such as "Internet" and "Web" are in all-lowercase, throughout the book, even though they are proper names. (In our world of instant messaging and Twitter, grammatical degeneration continues apace.) For any reader who wishes to follow along and implement the sample projects, possibly the most disappointing decision by the authors was that of offering the sample code not as a single archive file, or even individual archive files for each of the 13 chapters. Instead, the reader must tediously click through multiple layers of directories, just to get the code displayed in a browser, one file at a time. Readers are advised to employee a Web copying utility, which, given a starting URL, will try to download all of the linked pages, recursively, and store those Web pages and other Web elements on their own computer (even localizing links, to retain working navigation in the saved pages).

Yet by far the biggest problem with this book, is that while it claims to be an introductory text, suitable for someone completely unfamiliar with Android, it does not bring the newcomer up to speed at a reasonable pace for learning. Instead, it presents a large number of code snippets and tools to the reader, without adequate explanation for the beginner to truly understand what is happening. This pattern begins even in the first chapter, which is sorely lacking a tutorial on how to execute the sample code — to better understand it and perhaps modify it (a practice that most programmers find quite valuable for assimilating a new technology). On page 23 is a frustratingly brief sidebar on testing the receipt of an SMS message, that is far from adequate for the reader anxious to begin testing out this new material. The second chapter continues this unfortunate tendency of describing tools prior to giving the reader enough information to run those tools themselves in the same manner, and see the same results. For instance, on page 41, the authors show how to use the adb tool to connect to a running emulator session, but at that point the reader has no such sessions running. (Sometimes the authors of programming books understand the material quite well, but neglect to view it from the perspective of someone who does not yet have that understanding.)

While more appropriate for intermediate Android developers than claimed, Unlocking Android contains a wealth of information to help Java programmers begin developing mobile applications for Google's new platform, with numerous code snippets and screenshots.

Michael J. Ross is a freelance Web developer and writer.

You can purchase Unlocking Android from amazon.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

*

This discussion has been archived. No new comments can be posted.

Unlocking Android

Comments Filter:
  • by Estanislao Martínez (203477) on Monday June 29, 2009 @01:37PM (#28517433) Homepage

    The iPhone is winning on the basis of having a much superior interface. Open source development has always been notably bad at user interfaces, and more generally, at design; it is no accident that the most successful open source projects are all clones of some other software, or implementations of back-end protocols like HTTP. Very often superior clones, mind you, but it's still derivative.

  • by vertinox (846076) on Monday June 29, 2009 @01:53PM (#28517671)

    Open source development has always been notably bad at user interfaces, and more generally, at design; it is no accident that the most successful open source projects are all clones of some other software, or implementations of back-end protocols like HTTP.

    I know the OP is being a bit hostile, but with many Open Source projects UI are basically "what would I like to have" following then "what would my user's like to have" and followed "what my user's should have but don't know they need" last.

    I think more thought should be done to the interface via a graphic design and human nature standpoint rather than simply doing what you are the user asks for.

    I'm not saying that the developers or users are stupid, it is just that often when asked they really want, they don't know what they really want so they throw everything in and end up with feature UI bloat.

    Sometimes less is more, and if you work from a standpoint of what you shouldn't or can't do, and work around that, then sometimes you will make users less frustrated when having to remember what random command or finger swipe gesture does what.

    That said, if my iPhone resets its damn icon order again because I had my finger on the screen too long I'm GOING TO THROW IT VERY HARD!!

  • by curunir (98273) * on Monday June 29, 2009 @02:16PM (#28518009) Homepage Journal

    There's the HTC Magic [htc.com] that's out in some countries. This is the phone that Google gave to all the attendees at their recent I/O conference.

  • by MrMista_B (891430) on Monday June 29, 2009 @02:36PM (#28518281)

    Just felt like pointing out that you essentially just posted that 'This is a false statement unless it is a true statement'. :)

  • by Anonymous Coward on Monday June 29, 2009 @02:36PM (#28518289)

    This is hilariously wrong. For one thing, the UI of Android is distinctive, and not derivative of the iPhone in any appreciable manner (like the iPhone it has a lot of similarities with other, earlier touch-screen smartphones and PDAs, going back as far as the DEC Itsy and the Compaq iPaq, and the Palm VII).

    The snipe about open source being bad at 'design' is crass stupidity, unless you think that gcc, BSD, TCP/IP and webkit are all bad design... Apple doesn't. Android's design is subtle and sophisticated, with advanced features like gesture-based screen unlocking, and the "Intent"-based mechanism that allows apps to interact.

    Android apps are capable of some things that iPhone apps simply cannot do, and the hardware of the devices launched so far, designed by HTC, is significantly more advanced than the iPhone 3GS until it was launched. There are apps built on Android that were simply not possible on the iPhone until the 3GS (check out wikitude, Layar, Lastminute NRU and IBM's new Wimbledon navigator if you don't believe me).

    The iPhone is winning at the moment because of an astonishingly clever and successful marketing effort, polished delivery of product and the attention to detail that has allowed, for example, games to flourish, but unless you're a complete idiot you can't possibly believe it will remain dominant over a capable, fast-advancing, more hardware-agnostic OS that has sold a couple of million handsets on the back of almost no marketing whatsoever and is available for the entire industry to adopt. The fact that it is open source is not really that significant.

    iPhone's destiny is as a major but not dominant player, like the (lovely) Mac I am typing this on. Android is not broken, nor is it bad, and it has no flaws significant enough to stop it being deployed and improved by any number of players.

    Competition is a wonderful thing.

  • by LDoggg_ (659725) on Monday June 29, 2009 @03:37PM (#28519277) Homepage

    It's Java + Eclipse, which is notoriously slow when compared to XCode and the iPhone Simulator

    Eclipse isn't required for development, though it is extremely useful. And you don't like Java, there's a Native SDK now: http://developer.android.com/sdk/ndk/1.5_r1/index.html [android.com]

    UI design is done in very verbose XML, as opposed to Apple's Interface Builder, which lets you easily drag things where you want them

    The GUI is described in XML, but you don't have to use a text editor to build or edit it. There are in fact tools in Eclipse to drag and drop components into the GUI. Heck, there's even an applet I've seen that will do some point and clicky GUI creation and spit out XML.
    Would you rather that there was only a closed source proprietary IDE that spit out binary data to build your GUI for Android?

    Since Android is a platform and not tied to a single device, you have to design in "device independent pixels" which is much different than the iPhones set-in-stone 320x480 resolution

    You say that like it's a bad thing. So if apple decided to put out an in-dash car PC using the iphone OS, you'd like the fact that the existing iphone apps look like shit in it? Or would you want the in-dash screen to run at an obscenely low resolution?
    How about programming GUIs in way that allows them to play nicely in multiple screen resolutions?

    Core Animation... 'nuff said

    No, not enough. Please elaborate on why that makes iphone such a great platform to develop on.

  • It loads in under 3 seconds on my miserly entry level 8GB DDR2, 4core

    Since what month are 8 GB RAM and a quad-core CPU "entry level"?

We warn the reader in advance that the proof presented here depends on a clever but highly unmotivated trick. -- Howard Anton, "Elementary Linear Algebra"

Working...