Log In
Or create an account ->
Imperial Library
Home
About
News
Upload
Forum
Help
Login/SignUp
Index
Building Hybrid Android Apps with Java and JavaScript
Preface
Conventions Used in This Book
Using Code Examples
Safari® Books Online
How to Contact Us
Acknowledgments
Nizamettin Gok
Nitin Khanna
About the Technical Reviewer
Dedication
1. What Is Android?
Android Applications
What Is a Hybrid Application?
Categories of Applications
Key Characteristics of Hybrid Apps
Why Developing Hybrid Apps Makes Sense
Hybrid Application Architecture
How Do Hybrid Apps Work on the Android Platform?
2. Setting Up Your Android Development Environment
Installing Eclipse on Mac OS X
Installing Android Development Tools
Creating Your First Hybrid Android Project Using Eclipse IDE
Android Development Using the Command Line
Setting PATH Environment Variables
What Is ADB (Android Debug Bridge)?
Connecting an Android Device to the Development Host
Connecting to an Android Device Over WiFi
Using Apache Ant to Automate Building Android Applications
Understanding the Android Build Process
Resource Precompilation
Service Interface Precompilation
Java Compilation
DEX Generation
Resource Packaging
Creation of the APK File
Alignment
CSS Preprocessors
Installing SASS
Integrating SASS into the Android Command-Line Build System
JSLint Framework and Strict Coding Conventions
Process HTML Templates
Minifying CSS and JavaScript Files Using YUI Compressor
Using Safari and Chrome Browsers for Faster JavaScript Debugging and UI Changes
3. Android Fundamentals
Android Application Architecture
Key Android Components
Dalvik Virtual Machine (DVM)
View
Activity
Fragment
Intent
Services
Content Providers
Broadcast Receiver
Security Model in Android
Resources
String Resources
Layout Resources
Compiled and Uncompiled Android Resources
Assets
Structure of an Android App
Application Manifest
Application Package Name
Application
Activity
Intents
Intent Resolution
Intent Filter
Services
Broadcast Receiver
Specifying Compatible Device Configuration
Declaring Needed Device Features
Permissions
SDK Version
Hands-on Coding: Hybrid Hello World! Application
4. WebView, WebKit, and WebSettings
The WebView as a Web Browser
So What Is WebKit?
Requesting Internet Permission from Android Manifest
Instantiating and Accessing the WebView Control
Loading a Web Page
Loading HTML into WebView
WebViewClient
WebChromeClient
Loading Local Files into the WebView
Load Flash Files into the WebView
Reading Files from the res/raw Directory
Triggering JavaScript Functions from the Java Layer
Opening a WebView in Fullscreen Mode
Enabling a Resize Event in JavaScript While Your Application Is Fullscreen
Binding Java Objects to WebView Using the addJavaScriptInterface() Method
@JavaScriptInterface Annotations
Security Considerations for Hybrid Applications
HttpOnly Cookies and the Secure Flag
Domain Whitelisting
Configuring WebView Settings with WebSettings
Preventing Local Files from Being Loaded in the WebView
Enabling JavaScript
Setting Default Font Size
Zoom Controls
Hardware Acceleration
5. Inter-workings of the JavaScript and Java Layers
Architecture of a Hybrid Application
Calling Java Methods from JavaScript
Synchronous APIs
Asynchronous APIs
Calling JavaScript Methods from Java
Routing Data to the Correct JavaScript Receiver
Deferred Object Pattern
Register Success Callback Using deferred.done()
Register Failure Callback Using deferred.fail()
Register Progress Callback Using deferred.progress()
Simpler Callback registration with .then()
Synchronizing Multiple Asynchronous Events with $.when()
Resolve a Deferred Object
Reject a Deferred Object
Use of Promise
Use of deferred.progress()
Cache Manager for Handling Multiple Deferred Objects
Thread Safety
6. HTML Architecture for Hybrid Applications
Architecture of a Web Application
Single Page Applications (SPA)
Key Design Considerations for Single Page Applications
The Libraries and Frameworks for Your Hybrid Apps
Backbone.js for MVC Framework
Underscore.js for Utility Support
iScroll.js for scrolling
iScroll Caveats
jQuery.js for JavaScript application
Preload Images Within the CSS Files
CSS Reset Avoids Browser Inconsistencies
Your Home index.html
Viewport Meta Tag
Viewport Width
Viewport Scaling with the Content Attribute
Responsive Design and Media Queries
EM or Percent (%) unit for scalable interface
CSS3 Introduces rem Unit
Opacity or RGBA: What Is the Difference?
Event Pooling
7. CSS, DOM, and JavaScript: Optimization Tips and Useful Snippets
8. Publishing Apps for Android
Digitally Signing Applications
Protecting Your Application with ProGuard
Google Play
Registering as a Publisher
Developer Console
Uploading an Application
Amazon App Store
Self-Signing and the Amazon App Store
Amazon App Store Sign Up Process
Uploading an Application
Understanding the Application Approval Process
About the Authors
Colophon
Copyright
← Prev
Back
Next →
← Prev
Back
Next →