JavaScript Mobile Application Development
上QQ阅读APP看书,第一时间看更新

Preface

Mobile development is one of the hottest trends and an essentiality in today's software industry. As you might have noticed, almost every popular website today has its own equivalent mobile application version to allow its current users to access the website's functions from their mobiles and cater to a large number of users who don't have personal computers. Adding to this, with the powerful hardware specification and computing capability of today's smart phones, they have become real competitors to personal computers, and many people now prefer to use their smart phones for their daily activities (such as checking the current news, capturing videos and posting them on Facebook and YouTube, and checking e-mails), instead of using their personal computers.

Although developing mobile applications is a really interesting thing, it is worth mentioning that developing them on mobile platforms requires mobile developers to put in a lot of effort and have a wide skill set. For example, in order to develop a native mobile application on Android phones and tablets, the developer should be familiar with the Android SDK and Java programming language. In contrast, if there is a need to develop the same mobile application on iPhone and iPad devices, the mobile developer has to be familiar with Xcode and the Objective-C language. A developer on a Windows Phone, however, will require skills in .NET programming in order to develop an app.

Adding to the previous challenges, and as each mobile platform has its own philosophy of mobile application development, you will need to handle the different types of problems that you will face on every platform using different programming languages. For example, you might face a common problem when reimplementing your Android application logic (which is written using Java) on the Windows Phone 8 platform. The problem will most likely be that your code logic, which was sending an SMS directly from your application code without any interruptions, is not valid anymore, as in the Windows Phone platform, it is not allowed to send SMS messages from the application code without launching the default platform SMS application. This means that you will need to do this logic change in your new code, which is implemented using a different programming language (a .NET programming language in this case).

All of these challenges will cost you a huge amount of development and testing effort in order to develop an important mobile application that can work on many mobile platforms.

All of these previous facts and challenges offered me a great motive to write this book. This book is about how to efficiently develop mobile applications using common web technologies, such as HTML, CSS, and JavaScript. After finishing this book, you should be able to develop your mobile application on different mobile platforms using only JavaScript, without having to learn the native programming languages of every mobile platform. This will definitely reduce the development cost and effort of your cross-platform mobile application, as you will use only one popular programming language, which is JavaScript. Adding to this, using a single popular programming language to handle the different problem types of every mobile platform will allow handling these problems to be in a centralized place in the code. This increases the readability and maintainability of your mobile application code across mobile platforms.

In order to achieve this mission, this book focuses on Apache Cordova, a platform that uses HTML, CSS, and JavaScript to build mobile applications. Apache Cordova offers a set of APIs that allow the mobile application developer to access native mobile functions, which will be covered in more detail in Chapter 1, An Introduction to Apache Cordova.

The Apache Cordova project was originally known as PhoneGap. The PhoneGap project was started in 2008 by a company called Nitobi, with the goal to simplify cross-platform mobile development using a team of mobile developers. However, this framework supported only one platform: Apple iPhone. Fortunately, it then added Android and BlackBerry support.

In 2009, this project won the People's Choice Award at O'Reilly Media's 2009 Web 2.0 Conference, with the framework being used to develop many applications since then. The PhoneGap team continued working hard on the project to support more mobile platforms and enhance the project APIs.

In 2011, Adobe announced the acquisition of Nitobi, and the project contributed to Apache Software Foundation, first called Apache Callback and later renamed to Apache Cordova. Interestingly enough, Cordova was the name of the street where the Nitobi offices were located. In this book, Apache Cordova is the project that will be discussed.

In order to develop neat-looking mobile applications, this book also utilizes jQuery Mobile. jQuery Mobile is one of the best mobile web application frameworks, and it allows the web developer to develop web applications that are mobile friendly.

Finally, this book is a practical guide for web developers who need to develop interactive mobile applications using their current skill set. If you are a native mobile application developer who wants to develop your mobile applications in much less time and effort using JavaScript and Apache Cordova, you will also find this book to be incredibly useful.