23,99 €
With broad compatibility, the latest in web technologies, and powerful development tools, Firefox is a great choice for both web developers and end users. Firefox OS’s promotion of HTML5 as a first class citizen opens up the walled gardens of mobile application development for web developers. It is because of this initiative that no special SDKs are required to develop for Firefox OS.
This book will help you excel in the art of developing applications for Firefox OS. It sequentially covers knowledge building, skills acquisition, and practical applications.
Starting with an introduction to Firefox OS, usage of WebIDE, and then the application structure, this book introduces applications of increasing complexity with each chapter. An application that measures your tapping speed, a geolocation tagging application, and a photo editing and sharing application are the three applications that will be built from scratch. You will learn about topics such as the difference between various types of Firefox OS applications, application manifest files, offline apps, and designing principles for applications. You will also learn to test and submit the applications to the marketplace and finally maintain the repository of the Firefox OS application.
By the end, you will be able to develop beautifully designed, fully-fledged, and rigorously tested Firefox OS applications and also share them at the Firefox OS Marketplace.
Das E-Book können Sie in Legimi-Apps oder einer beliebigen App lesen, die das folgende Format unterstützen:
Seitenzahl: 167
Veröffentlichungsjahr: 2015
Copyright © 2015 Packt Publishing
All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews.
Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor Packt Publishing, and its dealers and distributors will be held liable for any damages caused or alleged to be caused directly or indirectly by this book.
Packt Publishing has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, Packt Publishing cannot guarantee the accuracy of this information.
First published: October 2015
Production reference: 1061015
Published by Packt Publishing Ltd.
Livery Place
35 Livery Street
Birmingham B3 2PB, UK.
ISBN 978-1-78398-940-9
www.packtpub.com
Mozilla, Firefox, and the Firefox logo are registered trademarks of the Mozilla Foundation, used with permission.
Author
Tanay Pant
Reviewers
Dietrich Ayala
Kumar Rishav
Commissioning Editor
Ashwin Nair
Acquisition Editor
Manish Nainani
Content Development Editor
Merwyn D'souza
Technical Editor
Utkarsha S. Kadam
Copy Editors
Imon Biswas
Vikrant Phadke
Project Coordinator
Neha Bhatnagar
Proofreader
Safis Editing
Indexer
Rekha Nair
Production Coordinator
Aparna Bhagat
Cover Work
Aparna Bhagat
Mozilla is a global community of technologists, thinkers, and builders working together to keep the Internet alive and accessible so that people worldwide can be informed contributors and creators of the Web. Our mission is to promote openness, innovation, and opportunities on the Web.
Firefox OS is our latest effort to put open and decentralized technologies of the Web at the heart of where the Internet goes next—beyond desktops and even smartphones—to encompass what some call the "Internet of Things," namely smart objects that talk to each other and to you. At Mozilla, we aspire to show you that all connected devices can be as open as the Web on our desktops, and ultimately help build a world where all our devices—and all of the data we create that connects them—give us choice, independence, and agency.
As a Mozilla rep, Tanay Pant has done a stellar job to help push the Mozilla mission forward across India and beyond, with a particular focus on helping talented developers learn how to contribute code to our various projects, including Firefox OS.
Learning Firefox OS Application Development is an excellent introduction to the Firefox OS project and shows you how to contribute to it from an application development perspective. I hope this book becomes a great resource for you and encourages you to become not only an active contributor to the Firefox OS platform, but also a strong advocate of our mission. Thank you for your interest in Mozilla and in helping us keep the Web open and participative. Happy reading!
May the source be with you!
William Quiviger
Global Community Manager, Mozilla
Tanay Pant is a developer, white hat, and writer who has a passion for web development. He contributes code to Mozilla Webmaker and is the chief architect of Stock Wolf (www.stockwolf.net), a global virtual stock trading platform that aims to impart practical education about stocks and markets. He is also a representative of Mozilla, and you can find his name listed under the credits (https://www.mozilla.org/credits/) of the Firefox web browser. You can also find articles written by him on web development at SitePoint and TutsPlus. Tanay acts as a security consultant and enjoys helping corporations fix vulnerabilities in their products.
I would like to express my gratitude to my father for being such a wonderful inspiration in my life, and my mother for being the most supportive person that I have ever seen.
I would like to thank my family, professors at the university, friends at Mozilla and Packt Publishing, and the many people who helped me through this book.
Then, I would like to thank Shubham Oli, who helped me to write chapters 6 and 7 and also to develop the various applications that have been included in this book.
I would also like to mention the names of my professors—Dr. H.L. Mandoria, Sanjay Joshi, Rajesh Shyam Singh, B.K. Pandey, Ashok Kumar, and S.P. Dwivedi of the College of Technology, Pantnagar—who encouraged and supported me in writing this book.
My deepest gratitude to all the teachers who have taught me from kindergarten to engineering.
Dietrich Ayala is a technical evangelist at Mozilla. He has been building web software designed to preserve choice and innovation on the Internet for nearly a decade, including the Firefox browser, the Firefox OS, and a number of other Mozilla projects. Before Mozilla, he spent time at Yahoo!, McAfee, Sub Pop Records, and various start-ups. He resides in Portland, Oregon, USA.
Kumar Rishav has been contributing to the Firefox OS project for the past 2 years. He is an open source enthusiast and evangelist. He was an intern at the Google Summer of Code 2014. Kumar is an application developer, coding freak, and bug hunter.
I would like to thank Tanay Pant for coming up with such awesome content. It is written in a nice way. Also, thanks to my mentors, Julien, Oleg, and Gabriele (Mozilla Employees), for always guiding me and showing me the right direction to work in.
For support files and downloads related to your book, please visit www.PacktPub.com.
Did you know that Packt offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.PacktPub.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at <[email protected]> for more details.
At www.PacktPub.com, you can also read a collection of free technical articles, sign up for a range of free newsletters and receive exclusive discounts and offers on Packt books and eBooks.
https://www2.packtpub.com/books/subscription/packtlib
Do you need instant solutions to your IT questions? PacktLib is Packt's online digital book library. Here, you can search, access, and read Packt's entire library of books.
If you have an account with Packt at www.PacktPub.com, you can use this to access PacktLib today and view 9 entirely free books. Simply use your login credentials for immediate access.
Mozilla publicly demonstrated the open source Firefox OS in February 2012. Firefox OS is an initiative by the open source company Mozilla to develop a mobile platform for smartphones as well as a host of other devices, such as tablets and televisions. The reason for rolling out this platform was to provide its users with an operating system that has an alternative that respects the user's privacy and puts security first. Firefox OS devices are a great choice for users who are transitioning from feature phones to smartphones or those who are concerned about privacy. Mozilla is best known for developing pieces of open source software, such as the Firefox web browser, and it doesn't answer its users rather than answering to stakeholders. The aim of Firefox OS is to run on devices that have limited hardware capabilities while still providing a unique and smooth user experience.
Mozilla has a huge community of developers and users, and they are always willing to help others on platforms such as GitHub and IRC (irc.mozilla.org). Firefox OS also has a great marketplace. It has grown over the years and offers great applications. In Firefox OS, HTML5 applications are first-class applications, and so any ordinary web application can be turned into a Firefox OS application in just a few steps. Even the user interface of Firefox OS, which is known as Gecko, has been built with the help of three components, namely HTML5, JavaScript, and CSS3. This makes developing applications easy for people who have already done web development.
Chapter 1, Introduction to Firefox OS, improves your understanding of Firefox OS by teaching its terminology, abstraction layer, and security model.
Chapter 2, Running Firefox OS Simulators with WebIDE, teaches you how to use WebIDE; install, uninstall, and create new applications; and use developer tools for applications running in WebIDE.
Chapter 3, Getting Your Hands Dirty – Firefox OS Apps, introduces the difference between packaged and hosted applications, security access levels of different Firefox OS applications, and developing application manifest files for apps.
Chapter 4, Diving Deeper with the Fox Creating Richer Apps, teaches you how to make hosted Firefox OS applications installable and offline. It then shows you how to apply web APIs to applications.
Chapter 5, Making Applications Visually Appealing – A Style Guide, takes you through the basic designing guidelines. These will help you make applications more user friendly. This chapter also tells you how to avoid some common UI blunders and apply the Gaia building blocks.
Chapter 6, Emerging as a Guru – Learning Web APIs, teaches web APIs, types of web APIs, web activities, and how to use them. This chapter also teaches you to implement all your acquired knowledge to build FoxFoto, a photo editing and sharing application.
Chapter 7, Testing Your Firefox OS Application, covers basic QA and unit testing, using Firefox developer tools for debugging, using the app validator to test applications, and using a spoof Firefox add-on for testing to improve the performance of a Firefox OS application.
Chapter 8, Firefox Marketplace – Setting up Your Bazaar, takes you through the Firefox Marketplace and shows you how to submit and update free and paid applications in the marketplace.
Chapter 9, Maintaining Your Firefox OS Application Code Professionally, takes you through setting up an account on GitHub, version controlling your Firefox OS application, and uploading the local repository to GitHub. It also teaches you how to set up Travis CI for your repository and host applications on RHCloud with the help of Git.
You will need the following:
This is a practical guide that uses hands-on examples to teach you how to create applications for Firefox OS and also how to port applications to the Firefox Marketplace. This book is intended for developers who want to build applications for Firefox OS. An understanding of HTML5, JavaScript, and CSS is required.
In this book, you will find a number of text styles that distinguish between different kinds of information. Here are some examples of these styles and an explanation of their meaning.
Code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and Twitter handles are shown as follows: "I have replaced World with Firefox everywhere to make it Hello Firefox."
A block of code is set as follows:
New terms and important words are shown in bold. Words that you see on the screen, for example, in menus or dialog boxes, appear in the text like this: "When you click on it, you will see the Install Simulator option."
Warnings or important notes appear in a box like this.
Tips and tricks appear like this.
Feedback from our readers is always welcome. Let us know what you think about this book—what you liked or disliked. Reader feedback is important for us as it helps us develop titles that you will really get the most out of.
To send us general feedback, simply e-mail <[email protected]>, and mention the book's title in the subject of your message.
If there is a topic that you have expertise in and you are interested in either writing or contributing to a book, see our author guide at www.packtpub.com/authors.
Now that you are the proud owner of a Packt book, we have a number of things to help you to get the most from your purchase.
You can download the example code files from your account at http://www.packtpub.com for all the Packt Publishing books you have purchased. If you purchased this book elsewhere, you can visit http://www.packtpub.com/support and register to have the files e-mailed directly to you.
We also provide you with a PDF file that has color images of the screenshots/diagrams used in this book. The color images will help you better understand the changes in the output. You can download this file from https://www.packtpub.com/sites/default/files/downloads/9409OS.pdf.
Although we have taken every care to ensure the accuracy of our content, mistakes do happen. If you find a mistake in one of our books—maybe a mistake in the text or the code—we would be grateful if you could report this to us. By doing so, you can save other readers from frustration and help us improve subsequent versions of this book. If you find any errata, please report them by visiting http://www.packtpub.com/submit-errata, selecting your book, clicking on the Errata Submission Form link, and entering the details of your errata. Once your errata are verified, your submission will be accepted and the errata will be uploaded to our website or added to any list of existing errata under the Errata section of that title.
To view the previously submitted errata, go to https://www.packtpub.com/books/content/support and enter the name of the book in the search field. The required information will appear under the Errata section.
Piracy of copyrighted material on the Internet is an ongoing problem across all media. At Packt, we take the protection of our copyright and licenses very seriously. If you come across any illegal copies of our works in any form on the Internet, please provide us with the location address or website name immediately so that we can pursue a remedy.
Please contact us at <[email protected]> with a link to the suspected pirated material.
We appreciate your help in protecting our authors and our ability to bring you valuable content.
If you have a problem with any aspect of this book, you can contact us at <[email protected]>, and we will do our best to address the problem.
In this chapter, you will improve your understanding of Firefox OS by learning about its terminology, architecture, abstraction layers, as well as the security model. We will discuss the reasons why it makes sense to develop or port applications to Firefox OS. We will also take a look at the Firefox OS devices currently available in the global market. We will go through the following topics in detail:
Mozilla and Telefónica started a joint project in 2011 under the code name Boot to Gecko—a new mobile operating system built on top of a web technology. Mozilla publicly demonstrated the open source Firefox OS in February 2012. The reason to roll out this platform was to provide developers with an alternative operating system that respects the user's privacy and security so that new smartphone users have a choice in buying. Firefox OS devices are a great choice for users who wish to make a transition from feature phones to smartphones, or for those who have concerns about the privacy settings. Mozilla is best known for developing open source software, such as Firefox Web Browser, and it answers to its users rather than answering to its stakeholders. The aim of Firefox OS is to run on devices that have limited hardware capabilities while still providing users with a unique and smooth experience.
Let's now take a look at a screenshot of a device that uses Firefox OS:
Firefox OS is one of the emerging platforms in the market, with devices having been released in a large number of countries. Developing applications for Firefox OS is very easy, especially for web developers, as Firefox OS treats HTML5 applications as first-class citizens, and hence there isn't any requirement to learn about using any unique platform-specific SDK.
