![Page 1: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/1.jpg)
Bringing the Open Web & APIs to mobile devices with Firefox OS
![Page 2: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/2.jpg)
![Page 3: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/3.jpg)
![Page 4: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/4.jpg)
![Page 7: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/7.jpg)
Mozilla is a global non-profit dedicated to putting you in control of your online experience and shaping the future of the Web for the public good
![Page 8: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/8.jpg)
![Page 9: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/9.jpg)
![Page 10: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/10.jpg)
![Page 11: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/11.jpg)
![Page 12: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/12.jpg)
Using HTML5, CSS and JavaScript together with a number of APIs to build apps and customize the UI.
Firefox OS
![Page 13: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/13.jpg)
"Movistar to offer the ZTE Open for €69, including €30 of balance for prepaid customers and a 4GB microSD card"
Launch!
![Page 14: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/14.jpg)
Foxconn
![Page 15: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/15.jpg)
![Page 16: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/16.jpg)
Open Web Apps
![Page 17: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/17.jpg)
![Page 18: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/18.jpg)
![Page 19: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/19.jpg)
HTML5 + manifest file (JSON)
![Page 20: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/20.jpg)
{ "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"}
![Page 21: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/21.jpg)
Packaged & hosted apps
![Page 22: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/22.jpg)
WebAPIs
![Page 23: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/23.jpg)
![Page 24: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/24.jpg)
![Page 25: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/25.jpg)
Security Levels
![Page 26: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/26.jpg)
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
![Page 27: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/27.jpg)
https://wiki.mozilla.org/WebAPI#Planned_for_initial_release_of_B2G_.28aka_Basecamp.29
![Page 28: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/28.jpg)
"permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" }}
![Page 29: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/29.jpg)
PERMISSIONS
![Page 30: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/30.jpg)
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
![Page 31: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/31.jpg)
BATTERY STATUS API
![Page 32: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/32.jpg)
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); }
![Page 33: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/33.jpg)
SCREENORIENTATION API
![Page 34: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/34.jpg)
// Portrait mode:screen.mozLockOrientation("portrait");
/* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary"*/
![Page 35: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/35.jpg)
VIBRATION API
![Page 36: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/36.jpg)
// Vibrate for one secondnavigator.vibrate(1000);
// Vibration pattern [vibrationTime, pause,…]navigator.vibrate([200, 100, 200, 100]);
// Vibrate for 5 secondsnavigator.vibrate(5000);
// Turn off vibrationnavigator.vibrate(0);
![Page 37: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/37.jpg)
DEVICEPROXIMITY
![Page 38: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/38.jpg)
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);});
![Page 39: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/39.jpg)
AMBIENT LIGHT EVENTS
![Page 40: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/40.jpg)
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 41: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/41.jpg)
PAGE VISIBILITY
![Page 42: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/42.jpg)
document.addEventListener("visibilitychange", function () { if (document.hidden) { console.log("App is hidden"); } else { console.log("App has focus"); }});
![Page 43: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/43.jpg)
Device Storage API
Browser API
TCP Socket API
Contacts API
systemXHR
PRIVILEGED APIS
![Page 44: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/44.jpg)
DEVICE STORAGE API
![Page 45: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/45.jpg)
var deviceStorage = navigator.getDeviceStorage("videos");
![Page 46: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/46.jpg)
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; }};
![Page 47: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/47.jpg)
WEB ACTIVITIES
![Page 48: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/48.jpg)
Interacting with the camera
![Page 49: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/49.jpg)
![Page 50: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/50.jpg)
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!");};
![Page 51: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/51.jpg)
{ "activities": { "share": { "filters": { "type": ["image/png", "image/gif"] } "href": "sharing.html", "disposition": "window" } }}
![Page 52: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/52.jpg)
navigator.mozSetMessageHandler("activity", function (a) { var img = getImageObject(); img.src = a.source.url; // Call a.postResult() or a.postError() if // the activity should return a value});
![Page 53: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/53.jpg)
Future APIs
![Page 54: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/54.jpg)
![Page 55: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/55.jpg)
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
![Page 56: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/56.jpg)
Web Apps from Mozilla
![Page 57: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/57.jpg)
![Page 58: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/58.jpg)
Dialer
Contacts
Settings
SMS
Web browser
Gallery
Video Player
Music Player
E-mail (POP, IMAP)
Calendar
Alarm Clock
Camera
Notes
First Run Experience
Notifications
Home Screen
Mozilla Marketplace
System Updater
Localization Support
![Page 60: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/60.jpg)
Get started
![Page 61: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/61.jpg)
https://addons.mozilla.org/firefox/addon/firefox-os-simulator/
![Page 62: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/62.jpg)
FIREFOX OS BOILERPLATE APP
https://github.com/robnyman/Firefox-OS-Boilerplate-App
![Page 63: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/63.jpg)
https://marketplace.firefox.com/
![Page 64: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/64.jpg)
https://marketplace.firefox.com/developers/
![Page 65: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/65.jpg)
Trying things out
![Page 66: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/66.jpg)
![Page 67: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/67.jpg)
![Page 68: Bringing the Open Web & APIs to mobile devices with Firefox OS, JSFoo, India](https://reader038.vdocuments.mx/reader038/viewer/2022102923/55495a26b4c905fc4e8b550d/html5/thumbnails/68.jpg)
Go have some fun!