SlideShare ist ein Scribd-Unternehmen logo
1 von 15
Downloaden Sie, um offline zu lesen
APPS FOR FIREFOX OS
What are they, and how can I build one?

Anant Narayanan
Mozilla

August 2012
The Web is the Platform
Apps on FirefoxOS are built exclusively using web technologies
The very same stack used to build (modern) web pages:
HTML(5)
CSS3
JavaScript
An app is simply a collection of web pages designed to look and
feel like one
Why the Web?
A single code-base for all platforms
Based on Open Standards
Participatory in nature, can get started very quickly & easily
No lock-in
Apps are not websites
A common mistake is to repurpose an existing website into an
app without any modification
Mobile devices operate in a unique environment that must be
take into account while designing an app
What are some common pitfalls?
3 big gotchas: Layout, Offline, Transitions
Layout
Mobile screens are not only smaller than desktops, but are also
subject to orientation changes by users
Readability is very important
Luckily, CSS3 has everything you need to serve different layouts
based on screen size!
Advanced templates like bootstrap will even gracefully switch
between different layouts (responsive design)
Offline
Unfortunately, you don’t get this for free
Special considerations must be made while developing the app
An arsenal of tools at your disposal to help you ranging from
localStorage to AppCache
Always check for errors!
XHRs are most susceptible
Launch & Transitions
The white page interstitial is acceptable when browsing the web,
but not when using an App
Special care should be taken to have a very smooth launch
experience by using a very small, quick to load page
Subsequent page loads should be handled with CSS3 transforms
to move in preloaded content to avoid the white screen effect
Fortunately, this is not hard to do in many JS frameworks
WebAPIs
Every piece of hardware in a phone running FirefoxOS is
accessible to JavaScript!

Geolocation, Camera, Accelerometer, Compass, TCP Sockets,
SMS, Phone, Vibration... what do you need as a developer?
Enough Talk, Show me the Code!
You can get started very quickly in just two steps:
Create an app template in Mortar
Deploy the app to a B2G Desktop build
Iterating on your app is easy with Firefox Nightly
Mortar
$ git clone https://github.com/mozilla/mortar.git
$ cd mortar && npm install
$ ./bin/build app-stub demo-app

B2G Desktop Build
$
$
$
$

wget http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/...
git clone https://github.com/mozilla-b2g/gaia
make -C gaia profile
/path/to/b2g -p gaia/profile
Identity with Persona
navigator.id.watch(callback);
navigator.id.request();

Integrating a login system is super easy!
Easy Payments
Support for paid apps...
mozmarket.receipts.verify(...);

... and in-app payments ...
let req = mozmarket.buy(...);
req.sign(jwt);
Firefox Nightly
All your standard developer tools, now in-built!
Responsive layout preview
DOM Tree Inspector (also available in 3D!)
Finishing Touches
Packaging
Only needed for certain types of apps
Submit to the Marketplace!
Happy Hacking!
HTML / CSS / JS
+
Mortar / Bootstrap
+
Firefox Nightly / B2G Desktop Build
=
An amazing app!

anant@mozilla.com

Weitere Àhnliche Inhalte

Mehr von Anant Narayanan

Mehr von Anant Narayanan (18)

WebRTC: User Security & Privacy
WebRTC: User Security & PrivacyWebRTC: User Security & Privacy
WebRTC: User Security & Privacy
 
Firefox Architecture Overview
Firefox Architecture OverviewFirefox Architecture Overview
Firefox Architecture Overview
 
πP
πPπP
πP
 
Next Generation Browser Add-Ons
Next Generation Browser Add-OnsNext Generation Browser Add-Ons
Next Generation Browser Add-Ons
 
An Overview of Distributed Debugging
An Overview of Distributed DebuggingAn Overview of Distributed Debugging
An Overview of Distributed Debugging
 
A Brief Incursion into Botnet Detection
A Brief Incursion into Botnet DetectionA Brief Incursion into Botnet Detection
A Brief Incursion into Botnet Detection
 
Mozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the BrowserMozilla Weave: Integrating Services into the Browser
Mozilla Weave: Integrating Services into the Browser
 
about:labs
about:labsabout:labs
about:labs
 
Distributed File Systems: An Overview
Distributed File Systems: An OverviewDistributed File Systems: An Overview
Distributed File Systems: An Overview
 
Innovating with Mozilla Labs
Innovating with Mozilla LabsInnovating with Mozilla Labs
Innovating with Mozilla Labs
 
Glendix: The Why and the How
Glendix: The Why and the HowGlendix: The Why and the How
Glendix: The Why and the How
 
Mozilla Prism
Mozilla PrismMozilla Prism
Mozilla Prism
 
Making Gentoo Tick
Making Gentoo TickMaking Gentoo Tick
Making Gentoo Tick
 
Introduction to XPConnect
Introduction to XPConnectIntroduction to XPConnect
Introduction to XPConnect
 
Unix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell LabsUnix++: Plan 9 from Bell Labs
Unix++: Plan 9 from Bell Labs
 
Introducing Plan9 from Bell Labs
Introducing Plan9 from Bell LabsIntroducing Plan9 from Bell Labs
Introducing Plan9 from Bell Labs
 
Extending Python with ctypes
Extending Python with ctypesExtending Python with ctypes
Extending Python with ctypes
 
Building Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and DojoBuilding Web Applications with MochiKit and Dojo
Building Web Applications with MochiKit and Dojo
 

KĂŒrzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

KĂŒrzlich hochgeladen (20)

Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Apps for FirefoxOS

  • 1. APPS FOR FIREFOX OS What are they, and how can I build one? Anant Narayanan Mozilla August 2012
  • 2. The Web is the Platform Apps on FirefoxOS are built exclusively using web technologies The very same stack used to build (modern) web pages: HTML(5) CSS3 JavaScript An app is simply a collection of web pages designed to look and feel like one
  • 3. Why the Web? A single code-base for all platforms Based on Open Standards Participatory in nature, can get started very quickly & easily No lock-in
  • 4. Apps are not websites A common mistake is to repurpose an existing website into an app without any modification Mobile devices operate in a unique environment that must be take into account while designing an app What are some common pitfalls? 3 big gotchas: Layout, Offline, Transitions
  • 5. Layout Mobile screens are not only smaller than desktops, but are also subject to orientation changes by users Readability is very important Luckily, CSS3 has everything you need to serve different layouts based on screen size! Advanced templates like bootstrap will even gracefully switch between different layouts (responsive design)
  • 6. Offline Unfortunately, you don’t get this for free Special considerations must be made while developing the app An arsenal of tools at your disposal to help you ranging from localStorage to AppCache Always check for errors! XHRs are most susceptible
  • 7. Launch & Transitions The white page interstitial is acceptable when browsing the web, but not when using an App Special care should be taken to have a very smooth launch experience by using a very small, quick to load page Subsequent page loads should be handled with CSS3 transforms to move in preloaded content to avoid the white screen effect Fortunately, this is not hard to do in many JS frameworks
  • 8. WebAPIs Every piece of hardware in a phone running FirefoxOS is accessible to JavaScript! Geolocation, Camera, Accelerometer, Compass, TCP Sockets, SMS, Phone, Vibration... what do you need as a developer?
  • 9. Enough Talk, Show me the Code! You can get started very quickly in just two steps: Create an app template in Mortar Deploy the app to a B2G Desktop build Iterating on your app is easy with Firefox Nightly
  • 10. Mortar $ git clone https://github.com/mozilla/mortar.git $ cd mortar && npm install $ ./bin/build app-stub demo-app B2G Desktop Build $ $ $ $ wget http://ftp.mozilla.org/pub/mozilla.org/b2g/nightly/... git clone https://github.com/mozilla-b2g/gaia make -C gaia profile /path/to/b2g -p gaia/profile
  • 12. Easy Payments Support for paid apps... mozmarket.receipts.verify(...); ... and in-app payments ... let req = mozmarket.buy(...); req.sign(jwt);
  • 13. Firefox Nightly All your standard developer tools, now in-built! Responsive layout preview DOM Tree Inspector (also available in 3D!)
  • 14. Finishing Touches Packaging Only needed for certain types of apps Submit to the Marketplace!
  • 15. Happy Hacking! HTML / CSS / JS + Mortar / Bootstrap + Firefox Nightly / B2G Desktop Build = An amazing app! anant@mozilla.com