Top Banner
Kickstarting FireFox OS App Development A.Mohammed Adam Activist in FSFTN Contributor in Mozilla
43
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: FirefoxOs App Development by Adam

KickstartingFireFox OS

App Development

A.Mohammed Adam Activist in FSFTN

Contributor in Mozilla

Page 2: FirefoxOs App Development by Adam
Page 3: FirefoxOs App Development by Adam

Yes you can!• You can start building Firefox os apps right now

if...

• You know HTML basics• You know basics of JavaScript• You have some idea with CSS

Page 4: FirefoxOs App Development by Adam

Contents

1. Intro2. Organization3. Tools you'll need4. Hello, World5. Tips & Tricks

Page 5: FirefoxOs App Development by Adam

1. Intro

• A brand new OS for smart phones• User-interface & Apps are written with HTML,

CSS & JS

• We're interested in building apps which runs in devices having FirefoxOS

Page 6: FirefoxOs App Development by Adam

It's already live!

Page 7: FirefoxOs App Development by Adam

2. Organization of FirefoxOS Apps

To develop any application, we worry about two things...

(Next Slides Will Tell)

Page 8: FirefoxOs App Development by Adam

User Interface

Pages, Forms, Buttons, sliders...

Page 9: FirefoxOs App Development by Adam

& Controls!

Logic programming, loops, working with data etc...

Page 10: FirefoxOs App Development by Adam

Organization While building FirefoxOS apps, we

Build user interface with HTML & CSS

& Javascript does the programming!

Page 11: FirefoxOs App Development by Adam

Philosophy So, FirefoxOs apps are basically Web Apps!

And since HTML/CSS/JavaScripts are standards, these apps run not only in FirefoxOs devices, but on any device that have a browser!!! (Yes, on your Android too*)

Don't misunderstand web apps - they run offline, too!

* Some APIs don't work in all browsers.

Page 12: FirefoxOs App Development by Adam

Let's Start!

Page 13: FirefoxOs App Development by Adam

3. Tools

Any text editor (to write code) Firefox browser 37.0+ (to see output!)

Optionally (highly recommended):

FirefoxOs Simulator Firebug (for debugging)

Page 14: FirefoxOs App Development by Adam

Text Editor Any text editor will work. We'll be making following types of

files:

HTML (.html) JavaScript (.js) CSS (.css)

You can use Sublime, Notepad++, Netbeans, Eclipse or even the basic editor which comes with your OS.

Page 15: FirefoxOs App Development by Adam

Firefox Browser

To see the complete functionality of your app, we'll use Firefox Browser - the desktop browser we all love.

We'll open the HTML files with our browser.

Page 16: FirefoxOs App Development by Adam

App Manager

App Manager comes built-in with Firefox37.0+. App manager can be used to Install Firefox OS simulator or

to send apps to your device.

Page 17: FirefoxOs App Development by Adam

Simulator

Page 18: FirefoxOs App Development by Adam

Hello, World!

It's time for a "Hello World" app, right now!

Page 19: FirefoxOs App Development by Adam

Step 1: Create a directory named hello

Create a directory named hello anywhere in your computer.

This will be the base directory - we put all files of our app here.

Page 20: FirefoxOs App Development by Adam

Step 2: Create file named index.html

Create a file index.html (it doesn't need to be index.html, it could be any name with .html extention) in the hello directory.

Page 21: FirefoxOs App Development by Adam

See it in your browser

Open the index.html file with your Firefox Browser. You can double-click or right-click then open with FirefoxBrowser.

Page 22: FirefoxOs App Development by Adam

Output

Page 23: FirefoxOs App Development by Adam

TIPSBut...doesn't look like a mobile app!

Because, we've not taken care of screen size & others.

To test mobile screens with various sizes, press Control + Shift + M in your Firefox!

Page 24: FirefoxOs App Development by Adam

Pressing ctrl + shft + M gives a mobile app look-&-feel!

Page 25: FirefoxOs App Development by Adam

Step 3: Create Manifest file

All Firefox OS apps need a manifest file.

The manifest file tells the app's name, description, permissions it requires and some other basic settings.

Manifest file can have any name, but it should have .webapp extension.

Page 26: FirefoxOs App Development by Adam

Create manifest.webapp file in project directory

We create manifest.webapp file (note the .webapp extention) in hello directory:

Page 27: FirefoxOs App Development by Adam

Install app in the simulator!1. Open App Manager by typing about:app-manager in the

address bar of browser

2. click Start Simulator > Firefox OS 1.4 from the bottom bar

3. Click Add Packaged App & select the folder which contains manifest.webapp file you just created.

4. Click updateBingo! Go to the simulator & fine our app installed.

Page 28: FirefoxOs App Development by Adam

App in Firefox OS Simulator

Page 29: FirefoxOs App Development by Adam

We've added a Batman Icon Too!

Page 30: FirefoxOs App Development by Adam

More Fun: Add some scripts

We will add a text input box and a button in our simple app.

When user clicks button, an alert box with the text in the input field will be shown.

Page 31: FirefoxOs App Development by Adam

Change the index.html fileto add the input elements

Page 32: FirefoxOs App Development by Adam

Create a file named hello.jsinside your project directory

Page 33: FirefoxOs App Development by Adam

Open Simulator and click Update

Page 34: FirefoxOs App Development by Adam

Congratulations!

You have created your first FirefoxOs app!

Page 35: FirefoxOs App Development by Adam

Tips & Tricks

Page 36: FirefoxOs App Development by Adam

Do we need to use the Simulator?

Not really. You can test your app using the Firefox Browser. I can test all the functionalities almost, using the browser &

mobile view.

So each time you update your app you can test by just refreshing the browser.

Page 37: FirefoxOs App Development by Adam

Using Frameworks

To give your app a mobile application like look and feel, you can use many frameworks.

jQuery Mobile is a cool framework, which turns your HTML stuffs into cool mobile app!

Also handle mobile input events like tap, tap-&-hold, swipe etc!

Building an app in 6 minutes using jQuery Mobile - you won't regret this!

Also shows usage of drag & drop interface to build UI!

Page 38: FirefoxOs App Development by Adam

Responsive Frameworks

Instead of building a framework from scratch, using a framework that support responsive design would be good idea.

Jquery Mobile is responsive!Many other responsive frameworks exist, of course.

Page 39: FirefoxOs App Development by Adam

Building Blocks

Check out Building Blocks to easily apply native look & feel and UI elements, transitions etc.

Many works are done already for your app!

Page 40: FirefoxOs App Development by Adam

Publishing your appOnce you've completed your app, you need to upload it in a

server, and share the link.Firefox Marketplace

You can submit your app in the Firefox Marketplace for more publicity!

Page 41: FirefoxOs App Development by Adam

Mozilla Developer Network (MDN)

MDN Will be your one-stop center for docs. You may also check out:

HTML5 JavaScript CSS Docs

Page 42: FirefoxOs App Development by Adam

For Demos: Apps Showdown

Need inspiration?

See some cool apps in action in the Demo Studio.

You may also try the Marketplace from Simulator.

Page 43: FirefoxOs App Development by Adam