Sunday, August 25, 2013

Book Review: Building Hybrid Android Apps with Java and JavaScript By Nizamettin Gok, Nitin Khanna (O'Reilly Media)

The book "Building Hybrid Android Apps with Java and Javascript" published July 2013 by O'Reilly is a very enjoyable, very informative 155 pages. This book reveals how Android applications can be created using standard Javascript, HTML, CSS and any additional bells and whistles such as jQuery, SASS and Backbone that you care to add.

I received a free copy of the eBook in return for this review as part of the O'Reilly blogger program.

I found this book is exactly what I look for in a tech book. It is a thorough getting started tutorial. It is a tutorial of several technologies and each is documented so well that I did not experience any hickups as I ran through the examples presented. I ran every command in the book and was successful with each. Google has their act together with Android and this book proves it.

It was the promise of hybrid Android apps that prompted me to select this book to read and review. I have no previous Android experience. I have a couple of Android books I purchased previously but I found I just did not want to deal with Eclipse in my free time since I use it at work. Fortunately, this book remedies my problem.

The author's use of "hybrid" refers to the combination of Java and Javascript and, intentionally or not, he also presents a hybrid build environment that allows a reader to use as much or as little Eclipse as one might want. In chapter 2, the book presents the Android tools that quickly and easily create ANT builds for for Android projects.

As promised by the title, Javascript is integral to the development of this breed of Android app. After using the Android tool to create a basic ANT build, the book relates how to install and use SASS, JSLint, Underscore.js and other resources and how to integrate them into the ANT build.

Chapter 3 (pages 35 - 60) is a concise but thorough explanation of the Android architecture, security model and UI model.

Chapter 4 (pages 61 - 77) starts us on the path to integrating Android with Webkit and Javascript. The details are revealed in chapter 5 (pages 79 - 92).

Chapter 6 (pages 93 - 106) introduces Single Page Applications, jQuery, Backbone and other Javascript libraries.

Chapters 7 and 8 are just as their titles describe.

Chapter 1: What Is Android?
Chapter 2: Setting Up Your Android Development Environment
Chapter 3: Android Fundamentals
Chapter 4: WebView, WebKit, and WebSettings
Chapter 5: Inter-workings of the JavaScript and Java Layers
Chapter 6: HTML Architecture for Hybrid Applications
Chapter 7: CSS, DOM, and JavaScript: Optimization Tips and Useful Snippets
Chapter 8: Publishing Apps for Android

The tips in chapter 7 focus on performance optimization and surprisingly the author points out which are appropriate for other types of applications as well as for hybrid Android apps. These are some great tips that I will use at the first opportunity.

No sample app is described in detail in the book. Chapter 3 completes a basic Hello World app. Chapter 5 adds AJAX. Code snippets from the book are available on GitHub.

An alternative to this book might be O'Reilly's "Building Android Apps with HTML, CSS, and JavaScript, 2nd Edition" published in January 2012.

Android's class documentation for WebKit is http://developer.android.com/reference/android/webkit/package-summary.html

The Android Developer documentation for WebKit applications is at http://developer.android.com/guide/webapps/overview.html

I review for the O'Reilly Blogger Review Program