SlideShare a Scribd company logo
FIREFOX OS

Fulfilling the promises of HTML5

Christian Heilmann (@codepo8)
DEVIEW 2013, Seoul, Korea.

When the iPhone reinvented the phone and shook the foundations of the mobile space one of the
promises was that there is "no SDK" and that HTML5 as the Flash successor will enable developers
to benefit from the web as a distribution platform and get access to the all hardware parts that
make a phone fun. This promise is now kept by Firefox OS, an operating system targeted at
emerging and existing markets that is written in HTML5 and gives HTML5 all the power it
deserves. In this session Chris Heilmann of Mozilla shows how easy it is to build engaging apps
using HTML5 and benefit from the simple distribution model that is the web. You'll learn how to
reach new audiences and re-use what you create in closed environments.
BENEFITS OF HTML5
★

In-built distribution - the web

★

Simple technologies used by lots of
developers

★

Evolution of existing practices

★

Open, independent, standardised

Let’s quickly recap what HTML5 promised us as a platform. In essence it was
an evolution of the web, taking advantage of its distributed nature and
extending its reach into hardware.
PROMISES OF HTML5

This was also the dream of Steve Jobs when the iPhone first came out. It was
a revolution, re-inventing the phone to be web-based rather than a closed
environment. No SDK required - just build like you build for the web.
LOCKOUT

In reality, things look different now. The browsers that come hard-wired with
mobile operating systems are very much falling behind when it comes to
their HTML5 support and developers have to resort to writing native apps.
FIREFOX OS

Firefox OS wants to change that. It is an open operating system based on
HTML5.
SOME FACTS…
★

Released in four countries: Spain, Poland, Venezuela and
Columbia (more to come very soon)

★

18 mobile operator partners, 6 hardware partners

★

Hardware options: Alcatel One Touch Fire, ZTE Open,
Geeksphone Keon, Geeksphone Peak…

★

Aimed at emerging markets/low end market

★

Aimed to be an alternative to feature phones and
unavailable closed environments.

★

Open source - it is all on GitHub

Firefox OS is not a test, it is not an idea. It is already very real.
"Movistar offers the
ZTE Open for €69,
including €30 of
balance for prepaid
customers and a
4GB microSD card"

Firefox OS devices are extremely affordable and aimed at people who have not
yet access to the web on the go.
ARCHITECTURE
Third Party HTML5 Apps
GAIA
Web APIs / Web Actitivies
Gecko rendering engine
Linux/Gonk (ADB enabled)
The architecture is simple, we build on top of the Gonk layer of Android (why
reinvent and open architecture) and added the Gecko rendering engine. On
top of that we have Web APIs and Activities, GAIA, the UI of Firefox OS and
third party HTML5 apps.
In essence it is Android without the Java.

+

=
PREDICTABLE HTML5 SUPPORT

The browser support for HTML5 is a given as it is the same engine as Firefox
on Desktop uses.
SECURITY
Security is a big issue when it comes to HTML5. The web as it is now is
suffering from some massive security holes which is why we can not allow
any JavaScript on the web to access for example the camera of your phone.
APPLICATION MANIFEST
{
"version": "1.0",
"name": "MozillaBall",
"description": "Exciting Open Web development action!",
"icons": {
"16": "/img/icon-16.png",
"48": "/img/icon-48.png",
"128": "/img/icon-128.png"
},
"developer": {
"name": "Mozilla Labs",
"url": "http://mozillalabs.com"
},
"installs_allowed_from": ["*"],
"appcache_path": "/cache.manifest",
"locales": {
"es": {
"description": "¡Acción abierta emocionante del desarrollo del Web!",
"developer": {
"url": "http://es.mozillalabs.com/"
}
}
},
"default_locale": "en"
}

HTML5 apps need to have a manifest file to be Firefox OS apps. In this one
you define what your app is, but also what kind of hardware access it needs.
APPLICATIONS
Web Content

Privileged Web App

Regular web content

More access, more
responsibility

Installed Web App

Certified Web App

A regular web app

Device-critical
applications

There are four kind of apps in Firefox OS - ranging from simple web content
to fully trusted apps that have access to all the hardware.
APPLICATIONS

The app permissions are defined in detail on the Mozilla Wiki.
PERMISSIONS
"permissions": {
"contacts": {
"description": "Required for autocompletion in the share screen",
"access": "readcreate"
},
"alarms": {
"description": "Required to schedule notifications"
}
}

You need to declare all the permissions you want in your manifest file.
WEB APIS
Web APIs are standards proposals and agreements with the W3C to enable
JavaScript to access hardware and sensors of devices.
WEB APIS (FOR ALL)
Vibration API (W3C)

Web Activities

Screen Orientation

Push Notifications API

Geolocation API

WebFM API

Mouse Lock API (W3C)

WebPayment

Open WebApps

IndexedDB (W3C)

Network Information API (W3C)

Ambient light sensor

Battery Status API (W3C)

Proximity sensor

Alarm API

Notification

These are a few of the APIs defined with the standards bodies to allow you
access to more than the screen. Some of the are enabled across browsers,
all of them in Firefox OS for any web content.
BATTERY STATUS
API

The battery status API allows you to read the current state of the battery. This
is very useful to build apps that warn the user before losing data.
BATTERY STATUS API
var battery = navigator.battery;
if (battery) {
var batteryLevel = Math.round(battery.level * 100) + "%",
charging = (battery.charging)? "" : "not ",
chargingTime = parseInt(battery.chargingTime / 60, 10),
dischargingTime = parseInt(battery.dischargingTime / 60, 10);
// Set events
battery.addEventListener("levelchange", setStatus, false);
battery.addEventListener("chargingchange", setStatus, false);
battery.addEventListener("chargingtimechange", setStatus, false);
battery.addEventListener("dischargingtimechange", setStatus, false);
}

You have various properties and events to listen to - this works across APIs.
SCREEN
ORIENTATION API

The screen orientation API allows you to lock the orientation of your app.
SCREEN ORIENTATION API
// Portrait mode:
screen.mozLockOrientation("portrait");
/*
Possible values:
"landscape"
"portrait"
"landscape-primary"
"landscape-secondary"
"portrait-primary"
"portrait-secondary"
*/
VIBRATION API

The vibration API allows you to make a phone vibrate.
VIBRATION API
// Vibrate for one second
navigator.vibrate(1000);
// Vibration pattern [vibrationTime, pause,…]
navigator.vibrate([200, 100, 200, 100]);
// Vibrate for 5 seconds
navigator.vibrate(5000);
// Turn off vibration
navigator.vibrate(0);
NETWORK
INFORMATION API

The Network Information API tells you what the connection is and if it is
metered or not. This helps your users not to spend too much money on
downloads and defer upgrades to when they are connected to WiFi.
NETWORK INFORMATION API

var connection = window.navigator.mozConnection,
online = connection.bandwidth > 0,
metered = connection.metered;
☼

AMBIENT LIGHT
EVENTS

The ambient light API allows you to detect if it is dark or light around the
device and switch design accordingly.
AMBIENT LIGHT EVENTS

window.addEventListener("devicelight", function (event) {
// The level of the ambient light in lux
// The lux values for "dim" typically begin below 50,
// and the values for "bright" begin above 10000
console.log(event.value);
});
PAGE VISIBILITY

The page visibility API tells you if the app is currently open and used or the
user has another one in focus.
PAGE VISIBILITY
document.addEventListener("visibilitychange", function () {
if (document.hidden) {
console.log("App is hidden");
}
else {
console.log("App has focus");
}
});
WEB APIS (PRIVILEGED APPS)
Device Storage API
Browser API
TCP Socket API
Contacts API
systemXHR

Privileged apps are those that went through a review by the Mozilla security
team and thus get more access to the hardware.
CONTACTS API

For example, privileged apps can create new contacts on the fly.
CONTACTS API
var contact = new mozContact();
contact.init({name: "Tom"});
var request = navigator.mozContacts.save(contact);
request.onsuccess = function() {
console.log("Success");
};
request.onerror = function() {
console.log("Error")
};
WEB APIS (CERTIFIED APPS)
WebTelephony

WebBluetooth

WebSMS

Permissions API

Idle API

Network Stats API

Settings API

Camera API

Power Management API

Time/Clock API

Mobile Connection API

Attention screen

WiFi Information API

Voicemail

Certified applications are the ones built by Mozilla and partners. These
needed APIs to access all the hardware.
CERTIFIED APPS = THE OS :)

We used these to build all the apps that make up the operating system.
CERTIFIED APPS = THE OS :)
Dialer

Alarm Clock

Contacts

Camera

Settings

Notes

SMS

First Run Experience

Web browser

Notifications

Gallery

Home Screen

Video Player

Mozilla Marketplace

Music Player

System Updater

E-mail (POP, IMAP)

Localization Support

Calendar
Like these.
WEB
ACTIVITIES
Web activities are a way to get access to the hardware without going through
a review process of your app. Instead of accessing the hardware directly,
the user will access it for you.
You can for example ask for a photo and the user then picks from their
gallery or takes a photo with the app of their choice. They then return
automatically to your app with the photo as a file blob.
GET A PHOTO?
var getphoto = new MozActivity({
name: "pick",
data: {
type: ["image/png", "image/jpeg"], "image/jpg"]
}
});
getphoto.onsuccess = function () {
var img = document.createElement("img");
if (this.result.blob.type.indexOf("image") != -1) {
img.src = window.URL.createObjectURL(this.result.blob);
}
};
getphoto.onerror = function () { // error
};
FIREFOX OS + ANDROID!

Activities allow for an app ecosystem on the device. You can ask the user to
become the app to do certain tasks and defer to other apps instead of
doing everything yourself. They also work on Android when you install
Firefox.
APP
DISTRIBUTION
App distribution on Firefox OS works in two ways: as a marketplace and by
distributing directly on the web using then Open Web Apps API.
FIREFOX OS MARKETPLACE

https://marketplace.firefox.com/
The marketplace works like any other out there: submit your app, get found,
get rich.
INSTALL FROM THE WEB…

var installapp = navigator.mozApps.install(manifestURL);
installapp.onsuccess = function(data) {
// App is installed
};
installapp.onerror = function() {
// App wasn't installed, info is in
// installapp.error.name
};

You can also re-use already existing web fame by adding a “install app”
button anywhere on the web calling this JavaScript. This means your SEO
efforts of the last years were not in vain.
DYNAMIC APP WEB SEARCH

Firefox OS has a unique way to search apps. Instead of just searching by
name and description, the search scans the web for apps and links them to
the intent of the user. For example a search for a band would find music
apps.
DEVELOPMENT
ENVIRONMENT
The big question about HTML5 is always about the development environment.
Firefox OS has no SDK or IDE, but we built a few tools to get you started faster
FIREFOX OS
BOILERPLATE APP

https://github.com/robnyman/Firefox-OS-Boilerplate-App
The Boilerplate App is a great way to start with Web Activities. In it you have
stub code for all activities and you can just comment out what you don’t
need.
FIREFOX OS SIMULATOR

https://addons.mozilla.org/firefox/addon/firefox-os-simulator/
The Simulator is and add-on for Firefox that runs a virtual phone on your
desktop, complete with debugging tools and the option to send apps from
the simulator to a real device.
PROTOTYPING WITH JSFIDDLE
1. Write your code as a JSFiddle
2. Append /webapp.manifest to your Fiddle
URL and paste this link into the Firefox OS
simulator to install the app
3. Alternatively, append /fxos.html to your
Fiddle URL to get an install page like a
typical Firefox OS hosted application

https://hacks.mozilla.org/2013/08/using-jsfiddle-to-prototype-firefox-os-apps/
JSFiddle is not only a great way to try out some functionality or ask for help
reviewing it - now it also features a way to make any code in it installable
as an application in the simulator or on a device.
BUILDING
BLOCKS?
Many people ask us for building blocks like the iOS ones. We don’t want to
stifle people in their creativity and there is no “one” Firefox OS look and
feel - there are guidelines - but here are some ideas.
CERTIFIED APPS BUILDING BLOCKS

http://buildingfirefoxos.com/
The creation of the OS-internal apps has been documented and all the
widgets used in their creation are available at buildingfirefoxos.com.
CERTIFIED APPS BUILDING BLOCKS

http://buildingfirefoxos.com/
This is a great resource to get inspiration for your own apps.
MOZILLA BRICK

http://mozilla.github.io/brick/
Mozilla Brick is a library to allow you to build apps from web components.
The benefit here is that your apps will perform much, much better and you
don’t need to write behaviour yourself.
WHAT’S
COOKING?
That’s a lot. But there is more around the corner.
MORE WEB APIS…
Resource lock API

Spellcheck API

UDP Datagram Socket API

LogAPI

Peer to Peer API

Keyboard/IME API

WebNFC

WebRTC

WebUSB

FileHandle API

HTTP-cache API

Sync API

Calendar API

We constantly extend the offering of Web APIs as we find new needs.
APPMAKER!
Resource lock API

Spellcheck API

UDP Datagram Socket API

LogAPI

Peer to Peer API

Keyboard/IME API

WebNFC

WebRTC

WebUSB

FileHandle API

HTTP-cache API

Sync API

Calendar API

Mozilla Appmaker is a WYSIWYG editor for apps that will allow beginners to
click together a Firefox OS app from Web Components.
RESOURCES
Where can you go if you want to learn more?
DEVELOPER HUB

https://marketplace.firefox.com/developers/
The developer hub is the one-stop-shop for Firefox OS. You find design
guidelines, demo apps and learn how to build and publish your apps.
MOZILLA DEVELOPER BLOG

https://hacks.mozilla.org/category/firefox-os/
The Mozilla hacks blog is our technical blog with lots of posts about new and
exciting features in Firefox and the OS.
FIREFOX OS VIDEO SERIES

https://hacks.mozilla.org/category/videoseries/
We’ve recorded a series of short video interviews showing the different parts
of Firefox OS. All of those are on YouTube.
FIREFOX OS WIKI

https://developer.mozilla.org/en/docs/Mozilla/Firefox_OS
Last but not least, there is the Firefox OS wiki with all the in-depth technical
information.
THANKS!

CHRIS HEILMANN
@CODEPO8

More Related Content

PDF
Fixing the mobile web - Internet World Romania
PDF
Firefox OS
PDF
Vision
PPT
I phone app develoment ppt
PDF
Cross-platform development frameworks
PPTX
PPTX
Appcelerator Titanium Intro
PPTX
Firefox OS Presentation
Fixing the mobile web - Internet World Romania
Firefox OS
Vision
I phone app develoment ppt
Cross-platform development frameworks
Appcelerator Titanium Intro
Firefox OS Presentation

What's hot (20)

PPTX
Firefox OS, introduction, concepts, architecture and hello world example
PPT
Making Money with Adobe AIR
PPTX
[Devoxx Morocco 2015] Apache Cordova In Action
PDF
Appium workshop technopark trivandrum
PPTX
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
PPTX
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
PPTX
Developing Enterprise-Grade Mobile Applications
PDF
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
PPTX
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
PPTX
Phone gap development, testing, and debugging
PPTX
Your First Adobe Flash Application for Android
PPTX
TiConf EU 2014
PPTX
Developing AIR for Android with Flash Professional CS5
PPTX
Developing AIR for Android with Flash Professional CS5
DOCX
Phone gap in android technology
PPTX
Developing AIR for Mobile with Flash Professional CS5.5
PDF
Mobile Web Development with HTML5
PPT
PDF
Extending Spring MVC with Spring Mobile and JavaScript
PPT
Firefox os-introduction
Firefox OS, introduction, concepts, architecture and hello world example
Making Money with Adobe AIR
[Devoxx Morocco 2015] Apache Cordova In Action
Appium workshop technopark trivandrum
[JavaLand 2015] Developing JavaScript Mobile Apps Using Apache Cordova
[JMaghreb 2014] Developing JavaScript Mobile Apps Using Apache Cordova
Developing Enterprise-Grade Mobile Applications
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Appcelerator Titanium - An Introduction to the Titanium Ecosystem
Phone gap development, testing, and debugging
Your First Adobe Flash Application for Android
TiConf EU 2014
Developing AIR for Android with Flash Professional CS5
Developing AIR for Android with Flash Professional CS5
Phone gap in android technology
Developing AIR for Mobile with Flash Professional CS5.5
Mobile Web Development with HTML5
Extending Spring MVC with Spring Mobile and JavaScript
Firefox os-introduction
Ad

Similar to (Christian heilman) firefox (20)

PDF
Firefox OS - HTML5 for a truly world-wide-web
PDF
Firefox OS - Answering global challenges
PDF
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
PDF
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
PDF
Web APIs & Apps - Mozilla
PDF
WebAPIs & Apps - Mozilla London
PPT
I phone app develoment ppt
PDF
Andriy Vandakurov about "Frontend. Global domination"
PDF
Pivorak.javascript.global domination
PDF
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
PPTX
Appium solution
PDF
Øredev2013 - FirefoxOS - the platform HTML5 deserves
PDF
Bringing the Open Web & APIs to 
mobile devices with Firefox OS, JSFoo, India
PPTX
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
PPTX
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
PPT
State ofappdevelopment
PPT
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
PDF
Empowering the "mobile web"
PDF
Empowering the Mobile Web - Mills
PDF
Empowering the “Mobile Web” with Chris Mills
Firefox OS - HTML5 for a truly world-wide-web
Firefox OS - Answering global challenges
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Web APIs & Apps - Mozilla
WebAPIs & Apps - Mozilla London
I phone app develoment ppt
Andriy Vandakurov about "Frontend. Global domination"
Pivorak.javascript.global domination
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - GOTO confer...
Appium solution
Øredev2013 - FirefoxOS - the platform HTML5 deserves
Bringing the Open Web & APIs to 
mobile devices with Firefox OS, JSFoo, India
Firefox OS - The platform you deserve - Firefox OS Budapest workshop - 2013-1...
Firefox OS - The platform you deserve - Athens App Days - 2013-11-27
State ofappdevelopment
Create Cross-Platform Native Mobile Apps in Flex with ELIPS Studio
Empowering the "mobile web"
Empowering the Mobile Web - Mills
Empowering the “Mobile Web” with Chris Mills
Ad

More from NAVER D2 (20)

PDF
[211] 인공지능이 인공지능 챗봇을 만든다
PDF
[233] 대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing: Maglev Hashing Scheduler i...
PDF
[215] Druid로 쉽고 빠르게 데이터 분석하기
PDF
[245]Papago Internals: 모델분석과 응용기술 개발
PDF
[236] 스트림 저장소 최적화 이야기: 아파치 드루이드로부터 얻은 교훈
PDF
[235]Wikipedia-scale Q&A
PDF
[244]로봇이 현실 세계에 대해 학습하도록 만들기
PDF
[243] Deep Learning to help student’s Deep Learning
PDF
[234]Fast & Accurate Data Annotation Pipeline for AI applications
PDF
Old version: [233]대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing
PDF
[226]NAVER 광고 deep click prediction: 모델링부터 서빙까지
PDF
[225]NSML: 머신러닝 플랫폼 서비스하기 & 모델 튜닝 자동화하기
PDF
[224]네이버 검색과 개인화
PDF
[216]Search Reliability Engineering (부제: 지진에도 흔들리지 않는 네이버 검색시스템)
PDF
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
PDF
[213] Fashion Visual Search
PDF
[232] TensorRT를 활용한 딥러닝 Inference 최적화
PDF
[242]컴퓨터 비전을 이용한 실내 지도 자동 업데이트 방법: 딥러닝을 통한 POI 변화 탐지
PDF
[212]C3, 데이터 처리에서 서빙까지 가능한 하둡 클러스터
PDF
[223]기계독해 QA: 검색인가, NLP인가?
[211] 인공지능이 인공지능 챗봇을 만든다
[233] 대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing: Maglev Hashing Scheduler i...
[215] Druid로 쉽고 빠르게 데이터 분석하기
[245]Papago Internals: 모델분석과 응용기술 개발
[236] 스트림 저장소 최적화 이야기: 아파치 드루이드로부터 얻은 교훈
[235]Wikipedia-scale Q&A
[244]로봇이 현실 세계에 대해 학습하도록 만들기
[243] Deep Learning to help student’s Deep Learning
[234]Fast & Accurate Data Annotation Pipeline for AI applications
Old version: [233]대형 컨테이너 클러스터에서의 고가용성 Network Load Balancing
[226]NAVER 광고 deep click prediction: 모델링부터 서빙까지
[225]NSML: 머신러닝 플랫폼 서비스하기 & 모델 튜닝 자동화하기
[224]네이버 검색과 개인화
[216]Search Reliability Engineering (부제: 지진에도 흔들리지 않는 네이버 검색시스템)
[214] Ai Serving Platform: 하루 수 억 건의 인퍼런스를 처리하기 위한 고군분투기
[213] Fashion Visual Search
[232] TensorRT를 활용한 딥러닝 Inference 최적화
[242]컴퓨터 비전을 이용한 실내 지도 자동 업데이트 방법: 딥러닝을 통한 POI 변화 탐지
[212]C3, 데이터 처리에서 서빙까지 가능한 하둡 클러스터
[223]기계독해 QA: 검색인가, NLP인가?

Recently uploaded (20)

PPTX
20250228 LYD VKU AI Blended-Learning.pptx
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Reach Out and Touch Someone: Haptics and Empathic Computing
PDF
Spectral efficient network and resource selection model in 5G networks
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Encapsulation_ Review paper, used for researhc scholars
PDF
Modernizing your data center with Dell and AMD
PPTX
Cloud computing and distributed systems.
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PPTX
Big Data Technologies - Introduction.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PPTX
Understanding_Digital_Forensics_Presentation.pptx
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Network Security Unit 5.pdf for BCA BBA.
PDF
Per capita expenditure prediction using model stacking based on satellite ima...
PPTX
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx
20250228 LYD VKU AI Blended-Learning.pptx
Digital-Transformation-Roadmap-for-Companies.pptx
How UI/UX Design Impacts User Retention in Mobile Apps.pdf
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Reach Out and Touch Someone: Haptics and Empathic Computing
Spectral efficient network and resource selection model in 5G networks
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Encapsulation_ Review paper, used for researhc scholars
Modernizing your data center with Dell and AMD
Cloud computing and distributed systems.
Diabetes mellitus diagnosis method based random forest with bat algorithm
Big Data Technologies - Introduction.pptx
Chapter 3 Spatial Domain Image Processing.pdf
Understanding_Digital_Forensics_Presentation.pptx
Unlocking AI with Model Context Protocol (MCP)
Network Security Unit 5.pdf for BCA BBA.
Per capita expenditure prediction using model stacking based on satellite ima...
KOM of Painting work and Equipment Insulation REV00 update 25-dec.pptx

(Christian heilman) firefox

  • 1. FIREFOX OS Fulfilling the promises of HTML5 Christian Heilmann (@codepo8) DEVIEW 2013, Seoul, Korea. When the iPhone reinvented the phone and shook the foundations of the mobile space one of the promises was that there is "no SDK" and that HTML5 as the Flash successor will enable developers to benefit from the web as a distribution platform and get access to the all hardware parts that make a phone fun. This promise is now kept by Firefox OS, an operating system targeted at emerging and existing markets that is written in HTML5 and gives HTML5 all the power it deserves. In this session Chris Heilmann of Mozilla shows how easy it is to build engaging apps using HTML5 and benefit from the simple distribution model that is the web. You'll learn how to reach new audiences and re-use what you create in closed environments.
  • 2. BENEFITS OF HTML5 ★ In-built distribution - the web ★ Simple technologies used by lots of developers ★ Evolution of existing practices ★ Open, independent, standardised Let’s quickly recap what HTML5 promised us as a platform. In essence it was an evolution of the web, taking advantage of its distributed nature and extending its reach into hardware.
  • 3. PROMISES OF HTML5 This was also the dream of Steve Jobs when the iPhone first came out. It was a revolution, re-inventing the phone to be web-based rather than a closed environment. No SDK required - just build like you build for the web.
  • 4. LOCKOUT In reality, things look different now. The browsers that come hard-wired with mobile operating systems are very much falling behind when it comes to their HTML5 support and developers have to resort to writing native apps.
  • 5. FIREFOX OS Firefox OS wants to change that. It is an open operating system based on HTML5.
  • 6. SOME FACTS… ★ Released in four countries: Spain, Poland, Venezuela and Columbia (more to come very soon) ★ 18 mobile operator partners, 6 hardware partners ★ Hardware options: Alcatel One Touch Fire, ZTE Open, Geeksphone Keon, Geeksphone Peak… ★ Aimed at emerging markets/low end market ★ Aimed to be an alternative to feature phones and unavailable closed environments. ★ Open source - it is all on GitHub Firefox OS is not a test, it is not an idea. It is already very real.
  • 7. "Movistar offers the ZTE Open for €69, including €30 of balance for prepaid customers and a 4GB microSD card" Firefox OS devices are extremely affordable and aimed at people who have not yet access to the web on the go.
  • 8. ARCHITECTURE Third Party HTML5 Apps GAIA Web APIs / Web Actitivies Gecko rendering engine Linux/Gonk (ADB enabled) The architecture is simple, we build on top of the Gonk layer of Android (why reinvent and open architecture) and added the Gecko rendering engine. On top of that we have Web APIs and Activities, GAIA, the UI of Firefox OS and third party HTML5 apps.
  • 9. In essence it is Android without the Java. + =
  • 10. PREDICTABLE HTML5 SUPPORT The browser support for HTML5 is a given as it is the same engine as Firefox on Desktop uses.
  • 11. SECURITY Security is a big issue when it comes to HTML5. The web as it is now is suffering from some massive security holes which is why we can not allow any JavaScript on the web to access for example the camera of your phone.
  • 12. APPLICATION MANIFEST { "version": "1.0", "name": "MozillaBall", "description": "Exciting Open Web development action!", "icons": { "16": "/img/icon-16.png", "48": "/img/icon-48.png", "128": "/img/icon-128.png" }, "developer": { "name": "Mozilla Labs", "url": "http://mozillalabs.com" }, "installs_allowed_from": ["*"], "appcache_path": "/cache.manifest", "locales": { "es": { "description": "¡Acción abierta emocionante del desarrollo del Web!", "developer": { "url": "http://es.mozillalabs.com/" } } }, "default_locale": "en" } HTML5 apps need to have a manifest file to be Firefox OS apps. In this one you define what your app is, but also what kind of hardware access it needs.
  • 13. APPLICATIONS Web Content Privileged Web App Regular web content More access, more responsibility Installed Web App Certified Web App A regular web app Device-critical applications There are four kind of apps in Firefox OS - ranging from simple web content to fully trusted apps that have access to all the hardware.
  • 14. APPLICATIONS The app permissions are defined in detail on the Mozilla Wiki.
  • 15. PERMISSIONS "permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" } } You need to declare all the permissions you want in your manifest file.
  • 16. WEB APIS Web APIs are standards proposals and agreements with the W3C to enable JavaScript to access hardware and sensors of devices.
  • 17. WEB APIS (FOR ALL) Vibration API (W3C) Web Activities Screen Orientation Push Notifications API Geolocation API WebFM API Mouse Lock API (W3C) WebPayment Open WebApps IndexedDB (W3C) Network Information API (W3C) Ambient light sensor Battery Status API (W3C) Proximity sensor Alarm API Notification These are a few of the APIs defined with the standards bodies to allow you access to more than the screen. Some of the are enabled across browsers, all of them in Firefox OS for any web content.
  • 18. BATTERY STATUS API The battery status API allows you to read the current state of the battery. This is very useful to build apps that warn the user before losing data.
  • 19. BATTERY STATUS API var battery = navigator.battery; if (battery) { var batteryLevel = Math.round(battery.level * 100) + "%", charging = (battery.charging)? "" : "not ", chargingTime = parseInt(battery.chargingTime / 60, 10), dischargingTime = parseInt(battery.dischargingTime / 60, 10); // Set events battery.addEventListener("levelchange", setStatus, false); battery.addEventListener("chargingchange", setStatus, false); battery.addEventListener("chargingtimechange", setStatus, false); battery.addEventListener("dischargingtimechange", setStatus, false); } You have various properties and events to listen to - this works across APIs.
  • 20. SCREEN ORIENTATION API The screen orientation API allows you to lock the orientation of your app.
  • 21. SCREEN ORIENTATION API // Portrait mode: screen.mozLockOrientation("portrait"); /* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary" */
  • 22. VIBRATION API The vibration API allows you to make a phone vibrate.
  • 23. VIBRATION API // Vibrate for one second navigator.vibrate(1000); // Vibration pattern [vibrationTime, pause,…] navigator.vibrate([200, 100, 200, 100]); // Vibrate for 5 seconds navigator.vibrate(5000); // Turn off vibration navigator.vibrate(0);
  • 24. NETWORK INFORMATION API The Network Information API tells you what the connection is and if it is metered or not. This helps your users not to spend too much money on downloads and defer upgrades to when they are connected to WiFi.
  • 25. NETWORK INFORMATION API var connection = window.navigator.mozConnection, online = connection.bandwidth > 0, metered = connection.metered;
  • 26. ☼ AMBIENT LIGHT EVENTS The ambient light API allows you to detect if it is dark or light around the device and switch design accordingly.
  • 27. AMBIENT LIGHT EVENTS window.addEventListener("devicelight", function (event) { // The level of the ambient light in lux // The lux values for "dim" typically begin below 50, // and the values for "bright" begin above 10000 console.log(event.value); });
  • 28. PAGE VISIBILITY The page visibility API tells you if the app is currently open and used or the user has another one in focus.
  • 29. PAGE VISIBILITY document.addEventListener("visibilitychange", function () { if (document.hidden) { console.log("App is hidden"); } else { console.log("App has focus"); } });
  • 30. WEB APIS (PRIVILEGED APPS) Device Storage API Browser API TCP Socket API Contacts API systemXHR Privileged apps are those that went through a review by the Mozilla security team and thus get more access to the hardware.
  • 31. CONTACTS API For example, privileged apps can create new contacts on the fly.
  • 32. CONTACTS API var contact = new mozContact(); contact.init({name: "Tom"}); var request = navigator.mozContacts.save(contact); request.onsuccess = function() { console.log("Success"); }; request.onerror = function() { console.log("Error") };
  • 33. WEB APIS (CERTIFIED APPS) WebTelephony WebBluetooth WebSMS Permissions API Idle API Network Stats API Settings API Camera API Power Management API Time/Clock API Mobile Connection API Attention screen WiFi Information API Voicemail Certified applications are the ones built by Mozilla and partners. These needed APIs to access all the hardware.
  • 34. CERTIFIED APPS = THE OS :) We used these to build all the apps that make up the operating system.
  • 35. CERTIFIED APPS = THE OS :) Dialer Alarm Clock Contacts Camera Settings Notes SMS First Run Experience Web browser Notifications Gallery Home Screen Video Player Mozilla Marketplace Music Player System Updater E-mail (POP, IMAP) Localization Support Calendar Like these.
  • 36. WEB ACTIVITIES Web activities are a way to get access to the hardware without going through a review process of your app. Instead of accessing the hardware directly, the user will access it for you.
  • 37. You can for example ask for a photo and the user then picks from their gallery or takes a photo with the app of their choice. They then return automatically to your app with the photo as a file blob.
  • 38. GET A PHOTO? var getphoto = new MozActivity({ name: "pick", data: { type: ["image/png", "image/jpeg"], "image/jpg"] } }); getphoto.onsuccess = function () { var img = document.createElement("img"); if (this.result.blob.type.indexOf("image") != -1) { img.src = window.URL.createObjectURL(this.result.blob); } }; getphoto.onerror = function () { // error };
  • 39. FIREFOX OS + ANDROID! Activities allow for an app ecosystem on the device. You can ask the user to become the app to do certain tasks and defer to other apps instead of doing everything yourself. They also work on Android when you install Firefox.
  • 40. APP DISTRIBUTION App distribution on Firefox OS works in two ways: as a marketplace and by distributing directly on the web using then Open Web Apps API.
  • 41. FIREFOX OS MARKETPLACE https://marketplace.firefox.com/ The marketplace works like any other out there: submit your app, get found, get rich.
  • 42. INSTALL FROM THE WEB… var installapp = navigator.mozApps.install(manifestURL); installapp.onsuccess = function(data) { // App is installed }; installapp.onerror = function() { // App wasn't installed, info is in // installapp.error.name }; You can also re-use already existing web fame by adding a “install app” button anywhere on the web calling this JavaScript. This means your SEO efforts of the last years were not in vain.
  • 43. DYNAMIC APP WEB SEARCH Firefox OS has a unique way to search apps. Instead of just searching by name and description, the search scans the web for apps and links them to the intent of the user. For example a search for a band would find music apps.
  • 44. DEVELOPMENT ENVIRONMENT The big question about HTML5 is always about the development environment. Firefox OS has no SDK or IDE, but we built a few tools to get you started faster
  • 45. FIREFOX OS BOILERPLATE APP https://github.com/robnyman/Firefox-OS-Boilerplate-App The Boilerplate App is a great way to start with Web Activities. In it you have stub code for all activities and you can just comment out what you don’t need.
  • 46. FIREFOX OS SIMULATOR https://addons.mozilla.org/firefox/addon/firefox-os-simulator/ The Simulator is and add-on for Firefox that runs a virtual phone on your desktop, complete with debugging tools and the option to send apps from the simulator to a real device.
  • 47. PROTOTYPING WITH JSFIDDLE 1. Write your code as a JSFiddle 2. Append /webapp.manifest to your Fiddle URL and paste this link into the Firefox OS simulator to install the app 3. Alternatively, append /fxos.html to your Fiddle URL to get an install page like a typical Firefox OS hosted application https://hacks.mozilla.org/2013/08/using-jsfiddle-to-prototype-firefox-os-apps/ JSFiddle is not only a great way to try out some functionality or ask for help reviewing it - now it also features a way to make any code in it installable as an application in the simulator or on a device.
  • 48. BUILDING BLOCKS? Many people ask us for building blocks like the iOS ones. We don’t want to stifle people in their creativity and there is no “one” Firefox OS look and feel - there are guidelines - but here are some ideas.
  • 49. CERTIFIED APPS BUILDING BLOCKS http://buildingfirefoxos.com/ The creation of the OS-internal apps has been documented and all the widgets used in their creation are available at buildingfirefoxos.com.
  • 50. CERTIFIED APPS BUILDING BLOCKS http://buildingfirefoxos.com/ This is a great resource to get inspiration for your own apps.
  • 51. MOZILLA BRICK http://mozilla.github.io/brick/ Mozilla Brick is a library to allow you to build apps from web components. The benefit here is that your apps will perform much, much better and you don’t need to write behaviour yourself.
  • 52. WHAT’S COOKING? That’s a lot. But there is more around the corner.
  • 53. MORE WEB APIS… Resource lock API Spellcheck API UDP Datagram Socket API LogAPI Peer to Peer API Keyboard/IME API WebNFC WebRTC WebUSB FileHandle API HTTP-cache API Sync API Calendar API We constantly extend the offering of Web APIs as we find new needs.
  • 54. APPMAKER! Resource lock API Spellcheck API UDP Datagram Socket API LogAPI Peer to Peer API Keyboard/IME API WebNFC WebRTC WebUSB FileHandle API HTTP-cache API Sync API Calendar API Mozilla Appmaker is a WYSIWYG editor for apps that will allow beginners to click together a Firefox OS app from Web Components.
  • 55. RESOURCES Where can you go if you want to learn more?
  • 56. DEVELOPER HUB https://marketplace.firefox.com/developers/ The developer hub is the one-stop-shop for Firefox OS. You find design guidelines, demo apps and learn how to build and publish your apps.
  • 57. MOZILLA DEVELOPER BLOG https://hacks.mozilla.org/category/firefox-os/ The Mozilla hacks blog is our technical blog with lots of posts about new and exciting features in Firefox and the OS.
  • 58. FIREFOX OS VIDEO SERIES https://hacks.mozilla.org/category/videoseries/ We’ve recorded a series of short video interviews showing the different parts of Firefox OS. All of those are on YouTube.
  • 59. FIREFOX OS WIKI https://developer.mozilla.org/en/docs/Mozilla/Firefox_OS Last but not least, there is the Firefox OS wiki with all the in-depth technical information.