SlideShare a Scribd company logo
Firefox OS WebAPIs, learnings & visions @robertnyman
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS 
Using HTML5, CSS and JavaScript 
together with a number of APIs to 
build apps and customize the UI.
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Open Web Apps
Firefox OS learnings & visions, WebAPIs - budapest.mobile
HTML5 + manifest file (JSON)
{ 
"version": "1", 
"name": "Firefox OS Boilerplate App", 
"launch_path": "/index.html", 
"description": "Boilerplate Firefox OS app", 
"icons": { 
"16": "/images/logo16.png", 
"32": "/images/logo32.png", 
"48": "/images/logo48.png", 
"64": "/images/logo64.png", 
"128": "/images/logo128.png" 
}, 
"developer": { 
"name": "Robert Nyman", 
"url": "http://robertnyman.com" 
}, 
"installs_allowed_from": ["*"], 
"default_locale": "en" 
}
Packaged & hosted apps
Firefox OS learnings & visions, WebAPIs - budapest.mobile
WebAPIs
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Security Levels
Web Content 
Regular web content 
Installed Web App 
A regular web app 
Privileged Web App 
More access, more responsibility 
Certified Web App 
Device-critical applications
https://wiki.mozilla.org/WebAPI#Planned_for_initial_release_of_B2G_. 
28aka_Basecamp.29
"permissions": { 
"contacts": { 
"description": "Required for autocompletion in the share screen", 
"access": "readcreate" 
}, 
"alarms": { 
"description": "Required to schedule notifications" 
} 
}
Permissions
Vibration API (W3C) 
Screen Orientation 
Geolocation API 
Mouse Lock API (W3C) 
Open WebApps 
Network Information API (W3C) 
Battery Status API (W3C) 
Alarm API 
Web Activities 
Push Notifications API 
WebFM API 
WebPayment 
IndexedDB (W3C) 
Ambient light sensor 
Proximity sensor 
Notification 
Regular APIs
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); 
}
Notifications
var notification = navigator.mozNotification; 
notification.createNotification( 
"See this", 
"This is a notification", 
iconURL 
);
Screen orientation API
// Portrait mode: 
screen.mozLockOrientation("portrait"); 
/* 
Possible values: 
"landscape" 
"portrait" 
"landscape-primary" 
"landscape-secondary" 
"portrait-primary" 
"portrait-secondary" 
*/
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);
DeviceProximity
window.addEventListener("deviceproximity", function (event) { 
// Current device proximity, in centimeters 
console.log(event.value); 
// The maximum sensing distance the sensor is 
// able to report, in centimeters 
console.log(event.max); 
// The minimum sensing distance the sensor is 
// able to report, in centimeters 
console.log(event.min); 
});
Ambient Light Events
window.addEventListener("devicelight", function (event) { 
// The lux values for "dim" typically begin below 50, 
// and the values for "bright" begin above 10000 
console.log(event.value); 
});
Page Visibility
document.addEventListener("visibilitychange", function () { 
if (document.hidden) { 
console.log("App is hidden"); 
} 
else { 
console.log("App has focus"); 
} 
});
Device Storage API 
Browser API 
TCP Socket API 
Contacts API 
systemXHR 
Privileged APIs
DEVICE STORAGE 
API
var deviceStorage = navigator.getDeviceStorage("videos");
var storage = navigator.getDeviceStorage("videos"), 
cursor = storage.enumerate(); 
cursor.onerror = function() { 
console.error("Error in DeviceStorage.enumerate()", cursor.error.name); 
}; 
cursor.onsuccess = function() { 
if (!cursor.result) 
return; 
var file = cursor.result; 
// If this isn't a video, skip it 
if (file.type.substring(0, 6) !== "video/") { 
cursor.continue(); 
return; 
} 
// If it isn't playable, skip it 
var testplayer = document.createElement("video"); 
if (!testplayer.canPlayType(file.type)) { 
cursor.continue(); 
return; 
} 
};
Web Activities
Firefox OS learnings & visions, WebAPIs - budapest.mobile
var activity = new MozActivity({ 
name: "view", 
data: { 
type: "image/png", 
url: ... 
} 
}); 
activity.onsuccess = function () { 
console.log("Showing the image!"); 
}; 
activity.onerror = function () { 
console.log("Can't view the image!"); 
};
{ 
"activities": { 
"share": { 
"filters": { 
"type": ["image/png", "image/gif"] 
} 
"href": "sharing.html", 
"disposition": "window" 
} 
} 
}
browse 
configure 
costcontrol 
dial 
open 
pick 
record 
save-bookmark 
share 
view 
update 
new: 
type:"mail", “websms/sms” or 
“webcontacts/contact”
Future APIs
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Resource lock API 
UDP Datagram Socket API 
Peer to Peer API 
WebNFC 
WebUSB 
HTTP-cache API 
Calendar API 
Spellcheck API 
LogAPI 
Keyboard/IME API 
WebRTC 
FileHandle API 
Sync API
WebNFC
{ 
"activities": { 
"nfc-ndef-discovered": { 
"filters": { 
"type": "url", 
"url": { 
"required":true, 
"pattern":"https?:.{1,16384}", 
"patternFlags":"i" 
} 
} 
} 
} 
}
navigator.mozSetMessageHandler("activity", handlerFunction); 
// Example handler to get the URL from the activity. 
function handlerFunction(activity) { 
if (activity.source.data.type == "url") { 
var url = activity.source.data.url; 
} 
}
"permissions": { 
"nfc": { 
"access": "readwrite" 
} 
}
// Constructing a MozNFCTag object 
function ndefDiscoveredHandler(activity) { 
var data = activity.source.data; 
var tag = navigator.mozNfc.getNFCTag(data.sessionToken); 
console.log(tag instanceof MozNFCTag); // should print true 
}
// Reading a MozNFCTag 
// tag is an instance of MozNFCTag 
var request = tag.readNDEF(); 
request.onsuccess = function() { 
var ndefRecords = request.result; 
// ndefRecords should be an array of MozNDEFRecord. 
};
// Sending data to peers via NFC 
navigator.mozNfc.onpeerready = function (evt) { 
var peer = navigator.mozNfc.getNFCPeer(evt.detail); 
console.log(peer instanceof MozNFCPeer); // should print true; 
// construct the NDEF records to send by creating 
// an array of MozNDEFRecord objecs. 
var request = peer.sendNDEF(ndefRecords); 
};
Get started
Firefox OS Boilerplate App 
https://github.com/robnyman/Firefox-OS-Boilerplate-App
Choose Device 
Tools > Web Developer > App Manager
Simulator 
Tools > Web Developer > App Manager
Inspector 
Tools > Web Developer > App Manager
Breakpoints 
Tools > Web Developer > App Manager
Events 
Tools > Web Developer > App Manager
Debug system apps 
Tools > Web Developer > App Manager
Debug system apps - Firefox 
Tools > Web Developer > App Manager
Debug system apps - Firefox on the device 
Tools > Web Developer > App Manager
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman 
robertnyman.com 
robert@mozilla.com 
Mozilla 
@robertnyman

More Related Content

What's hot (20)

KEY
Node.js 0.8 features
Nicholas McClay
 
PDF
Intro to Sail.js
Nicholas McClay
 
PDF
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Robert Nyman
 
PDF
The Open Web and what it means
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 
PDF
Puppet modules for Fun and Profit
Alessandro Franceschi
 
PDF
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
PPTX
Vue.js + Django - configuración para desarrollo con webpack y HMR
Javier Abadía
 
PDF
HTML5: where flash isn't needed anymore
Remy Sharp
 
PDF
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
Robert Nyman
 
PDF
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
PDF
7주 JavaScript 실습
지수 윤
 
KEY
Loadrunner
danwrong
 
PDF
YUI on the go
Christian Heilmann
 
PDF
Ember.js - A JavaScript framework for creating ambitious web applications
Juliana Lucena
 
PDF
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
 
PDF
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Provectus
 
PDF
JavaScript APIs - The Web is the Platform
Robert Nyman
 
PDF
JavaScript & HTML5 - Brave New World
Robert Nyman
 
Node.js 0.8 features
Nicholas McClay
 
Intro to Sail.js
Nicholas McClay
 
Leave No One Behind with HTML5 - FFWD.PRO, Croatia
Robert Nyman
 
The Open Web and what it means
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Santiago, Chile
Robert Nyman
 
Puppet modules for Fun and Profit
Alessandro Franceschi
 
JavaScript APIs - The Web is the Platform - MozCamp, Buenos Aires
Robert Nyman
 
JavaScript APIs - The Web is the Platform - MDN Hack Day, Montevideo
Robert Nyman
 
Vue.js + Django - configuración para desarrollo con webpack y HMR
Javier Abadía
 
HTML5: where flash isn't needed anymore
Remy Sharp
 
JavaScript APIs - The Web is the Platform - MDN Hack Day - Buenos Aires
Robert Nyman
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
7주 JavaScript 실습
지수 윤
 
Loadrunner
danwrong
 
YUI on the go
Christian Heilmann
 
Ember.js - A JavaScript framework for creating ambitious web applications
Juliana Lucena
 
WebAPIs & WebRTC - Spotify/sthlm.js
Robert Nyman
 
Василевский Илья (Fun-box): "автоматизация браузера при помощи PhantomJS"
Provectus
 
JavaScript APIs - The Web is the Platform
Robert Nyman
 
JavaScript & HTML5 - Brave New World
Robert Nyman
 

Viewers also liked (17)

PDF
S tree model - building resilient cities
Robert Nyman
 
PDF
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Robert Nyman
 
PDF
HTML5 - The 2012 of the Web - Adobe MAX
Robert Nyman
 
PDF
HTML5 & The Open Web - at Nackademin
Robert Nyman
 
PDF
HTML5, The Open Web, and what it means for you - Altran
Robert Nyman
 
PDF
Using HTML5 for a great Open Web
Robert Nyman
 
PDF
Firefox OS Introduction at Bontouch
Robert Nyman
 
PDF
JavaScript - Like a Box of Chocolates - jsDay
Robert Nyman
 
PDF
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
PDF
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Robert Nyman
 
PDF
HTML5, The Open Web, and what it means for you - MDN Hack Day, Sao Paulo
Robert Nyman
 
PDF
What are you going to do with your life? Geek Meet Västerås
Robert Nyman
 
PDF
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
PDF
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
PDF
An Introduction To HTML5
Robert Nyman
 
PDF
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
PDF
Five Stages of Development - Nordic.js
Robert Nyman
 
S tree model - building resilient cities
Robert Nyman
 
HTML5 and CSS3 – exploring mobile possibilities - Dynabyte event
Robert Nyman
 
HTML5 - The 2012 of the Web - Adobe MAX
Robert Nyman
 
HTML5 & The Open Web - at Nackademin
Robert Nyman
 
HTML5, The Open Web, and what it means for you - Altran
Robert Nyman
 
Using HTML5 for a great Open Web
Robert Nyman
 
Firefox OS Introduction at Bontouch
Robert Nyman
 
JavaScript - Like a Box of Chocolates - jsDay
Robert Nyman
 
HTML5 APIs - Where no man has gone before! - Altran
Robert Nyman
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - SpainJS
Robert Nyman
 
HTML5, The Open Web, and what it means for you - MDN Hack Day, Sao Paulo
Robert Nyman
 
What are you going to do with your life? Geek Meet Västerås
Robert Nyman
 
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
The Future of the Web - Cold Front conference 2016
Robert Nyman
 
An Introduction To HTML5
Robert Nyman
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
Robert Nyman
 
Five Stages of Development - Nordic.js
Robert Nyman
 
Ad

Similar to Firefox OS learnings & visions, WebAPIs - budapest.mobile (20)

PDF
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
PDF
Firefox OS workshop, JSFoo, India
Robert Nyman
 
PDF
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
Frédéric Harper
 
PDF
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
PDF
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - Geek Meet
Robert Nyman
 
PDF
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
Frédéric Harper
 
PDF
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Robert Nyman
 
PDF
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Frédéric Harper
 
PDF
Taking Web Apps Offline
Pedro Morais
 
PDF
Web APIs & Apps - Mozilla
Robert Nyman
 
PDF
WebAPIs & Apps - Mozilla London
Robert Nyman
 
PDF
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 
KEY
Intro To webOS
fpatton
 
PPTX
Firefox OS Web APIs, taking it to the next level
Frédéric Harper
 
PDF
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Robert Nyman
 
PPTX
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Frédéric Harper
 
PDF
HTML5 APIs - Where No Man Has Gone Before! - GothamJS
Robert Nyman
 
PDF
How to React Native
Dmitry Ulyanov
 
KEY
BlackBerry DevCon 2011 - PhoneGap and WebWorks
mwbrooks
 
Bringing the open web and APIs to mobile devices with Firefox OS - Whisky W...
Robert Nyman
 
Firefox OS workshop, JSFoo, India
Robert Nyman
 
HTML pour le web mobile, Firefox OS - Devfest Nantes - 2014-11-07
Frédéric Harper
 
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
Bringing the Open Web & APIs to 
mobile devices with Firefox OS - Geek Meet
Robert Nyman
 
HTML, not just for desktops: Firefox OS - Congreso Universitario Móvil - 201...
Frédéric Harper
 
JavaScript APIs - The Web is the Platform - .toster conference, Moscow
Robert Nyman
 
Firefox OS, HTML5 to the next level - Python Montreal - 2014-05-12
Frédéric Harper
 
Taking Web Apps Offline
Pedro Morais
 
Web APIs & Apps - Mozilla
Robert Nyman
 
WebAPIs & Apps - Mozilla London
Robert Nyman
 
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 
Intro To webOS
fpatton
 
Firefox OS Web APIs, taking it to the next level
Frédéric Harper
 
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Robert Nyman
 
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Frédéric Harper
 
HTML5 APIs - Where No Man Has Gone Before! - GothamJS
Robert Nyman
 
How to React Native
Dmitry Ulyanov
 
BlackBerry DevCon 2011 - PhoneGap and WebWorks
mwbrooks
 
Ad

More from Robert Nyman (20)

PDF
Have you tried listening?
Robert Nyman
 
PDF
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
PDF
Introduction to Google Daydream
Robert Nyman
 
PDF
Predictability for the Web
Robert Nyman
 
PDF
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
PDF
Google tech & products
Robert Nyman
 
PDF
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
PDF
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
PDF
The web - What it has, what it lacks and where it must go
Robert Nyman
 
PDF
Google, the future and possibilities
Robert Nyman
 
PDF
Developer Relations in the Nordics
Robert Nyman
 
PDF
What is Developer Relations?
Robert Nyman
 
PDF
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
PDF
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 
PDF
Google & gaming, IGDA - Helsinki
Robert Nyman
 
PDF
Firefox OS - mobile trends, learnings & visions, at FOKUS FUSECO Forum 2014
Robert Nyman
 
PDF
Streem - Water footprint, behavior and awareness
Robert Nyman
 
Have you tried listening?
Robert Nyman
 
Building for Your Next Billion - Google I/O 2017
Robert Nyman
 
Introduction to Google Daydream
Robert Nyman
 
Predictability for the Web
Robert Nyman
 
The Future of Progressive Web Apps - Google for Indonesia
Robert Nyman
 
Google tech & products
Robert Nyman
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Robert Nyman
 
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Robert Nyman
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
Robert Nyman
 
The web - What it has, what it lacks and where it must go - Istanbul
Robert Nyman
 
The web - What it has, what it lacks and where it must go
Robert Nyman
 
Google, the future and possibilities
Robert Nyman
 
Developer Relations in the Nordics
Robert Nyman
 
What is Developer Relations?
Robert Nyman
 
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 
Google & gaming, IGDA - Helsinki
Robert Nyman
 
Firefox OS - mobile trends, learnings & visions, at FOKUS FUSECO Forum 2014
Robert Nyman
 
Streem - Water footprint, behavior and awareness
Robert Nyman
 

Recently uploaded (20)

PDF
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
PPTX
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
PDF
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
PDF
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
PDF
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
PDF
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
PDF
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
PDF
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
PDF
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
PDF
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
PPTX
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PDF
July Patch Tuesday
Ivanti
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
CIFDAQ Market Insights for July 7th 2025
CIFDAQ
 
"Autonomy of LLM Agents: Current State and Future Prospects", Oles` Petriv
Fwdays
 
LLMs.txt: Easily Control How AI Crawls Your Site
Keploy
 
Complete JavaScript Notes: From Basics to Advanced Concepts.pdf
haydendavispro
 
Log-Based Anomaly Detection: Enhancing System Reliability with Machine Learning
Mohammed BEKKOUCHE
 
Timothy Rottach - Ramp up on AI Use Cases, from Vector Search to AI Agents wi...
AWS Chicago
 
DevBcn - Building 10x Organizations Using Modern Productivity Metrics
Justin Reock
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
[Newgen] NewgenONE Marvin Brochure 1.pdf
darshakparmar
 
Achieving Consistent and Reliable AI Code Generation - Medusa AI
medusaaico
 
SWEBOK Guide and Software Services Engineering Education
Hironori Washizaki
 
From Code to Challenge: Crafting Skill-Based Games That Engage and Reward
aiyshauae
 
Q2 FY26 Tableau User Group Leader Quarterly Call
lward7
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
July Patch Tuesday
Ivanti
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 

Firefox OS learnings & visions, WebAPIs - budapest.mobile

  • 1. Firefox OS WebAPIs, learnings & visions @robertnyman
  • 13. Firefox OS Using HTML5, CSS and JavaScript together with a number of APIs to build apps and customize the UI.
  • 18. HTML5 + manifest file (JSON)
  • 19. { "version": "1", "name": "Firefox OS Boilerplate App", "launch_path": "/index.html", "description": "Boilerplate Firefox OS app", "icons": { "16": "/images/logo16.png", "32": "/images/logo32.png", "48": "/images/logo48.png", "64": "/images/logo64.png", "128": "/images/logo128.png" }, "developer": { "name": "Robert Nyman", "url": "http://robertnyman.com" }, "installs_allowed_from": ["*"], "default_locale": "en" }
  • 26. Web Content Regular web content Installed Web App A regular web app Privileged Web App More access, more responsibility Certified Web App Device-critical applications
  • 28. "permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" } }
  • 30. Vibration API (W3C) Screen Orientation Geolocation API Mouse Lock API (W3C) Open WebApps Network Information API (W3C) Battery Status API (W3C) Alarm API Web Activities Push Notifications API WebFM API WebPayment IndexedDB (W3C) Ambient light sensor Proximity sensor Notification Regular APIs
  • 32. 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); }
  • 34. var notification = navigator.mozNotification; notification.createNotification( "See this", "This is a notification", iconURL );
  • 36. // Portrait mode: screen.mozLockOrientation("portrait"); /* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary" */
  • 38. // 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);
  • 40. window.addEventListener("deviceproximity", function (event) { // Current device proximity, in centimeters console.log(event.value); // The maximum sensing distance the sensor is // able to report, in centimeters console.log(event.max); // The minimum sensing distance the sensor is // able to report, in centimeters console.log(event.min); });
  • 42. window.addEventListener("devicelight", function (event) { // The lux values for "dim" typically begin below 50, // and the values for "bright" begin above 10000 console.log(event.value); });
  • 44. document.addEventListener("visibilitychange", function () { if (document.hidden) { console.log("App is hidden"); } else { console.log("App has focus"); } });
  • 45. Device Storage API Browser API TCP Socket API Contacts API systemXHR Privileged APIs
  • 47. var deviceStorage = navigator.getDeviceStorage("videos");
  • 48. var storage = navigator.getDeviceStorage("videos"), cursor = storage.enumerate(); cursor.onerror = function() { console.error("Error in DeviceStorage.enumerate()", cursor.error.name); }; cursor.onsuccess = function() { if (!cursor.result) return; var file = cursor.result; // If this isn't a video, skip it if (file.type.substring(0, 6) !== "video/") { cursor.continue(); return; } // If it isn't playable, skip it var testplayer = document.createElement("video"); if (!testplayer.canPlayType(file.type)) { cursor.continue(); return; } };
  • 51. var activity = new MozActivity({ name: "view", data: { type: "image/png", url: ... } }); activity.onsuccess = function () { console.log("Showing the image!"); }; activity.onerror = function () { console.log("Can't view the image!"); };
  • 52. { "activities": { "share": { "filters": { "type": ["image/png", "image/gif"] } "href": "sharing.html", "disposition": "window" } } }
  • 53. browse configure costcontrol dial open pick record save-bookmark share view update new: type:"mail", “websms/sms” or “webcontacts/contact”
  • 56. Resource lock API UDP Datagram Socket API Peer to Peer API WebNFC WebUSB HTTP-cache API Calendar API Spellcheck API LogAPI Keyboard/IME API WebRTC FileHandle API Sync API
  • 58. { "activities": { "nfc-ndef-discovered": { "filters": { "type": "url", "url": { "required":true, "pattern":"https?:.{1,16384}", "patternFlags":"i" } } } } }
  • 59. navigator.mozSetMessageHandler("activity", handlerFunction); // Example handler to get the URL from the activity. function handlerFunction(activity) { if (activity.source.data.type == "url") { var url = activity.source.data.url; } }
  • 60. "permissions": { "nfc": { "access": "readwrite" } }
  • 61. // Constructing a MozNFCTag object function ndefDiscoveredHandler(activity) { var data = activity.source.data; var tag = navigator.mozNfc.getNFCTag(data.sessionToken); console.log(tag instanceof MozNFCTag); // should print true }
  • 62. // Reading a MozNFCTag // tag is an instance of MozNFCTag var request = tag.readNDEF(); request.onsuccess = function() { var ndefRecords = request.result; // ndefRecords should be an array of MozNDEFRecord. };
  • 63. // Sending data to peers via NFC navigator.mozNfc.onpeerready = function (evt) { var peer = navigator.mozNfc.getNFCPeer(evt.detail); console.log(peer instanceof MozNFCPeer); // should print true; // construct the NDEF records to send by creating // an array of MozNDEFRecord objecs. var request = peer.sendNDEF(ndefRecords); };
  • 65. Firefox OS Boilerplate App https://github.com/robnyman/Firefox-OS-Boilerplate-App
  • 66. Choose Device Tools > Web Developer > App Manager
  • 67. Simulator Tools > Web Developer > App Manager
  • 68. Inspector Tools > Web Developer > App Manager
  • 69. Breakpoints Tools > Web Developer > App Manager
  • 70. Events Tools > Web Developer > App Manager
  • 71. Debug system apps Tools > Web Developer > App Manager
  • 72. Debug system apps - Firefox Tools > Web Developer > App Manager
  • 73. Debug system apps - Firefox on the device Tools > Web Developer > App Manager