SlideShare a Scribd company logo
Bringing the Open Web & APIs to
 mobile devices with Firefox OS
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
@robertnyman
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
Firefox OS




  Using HTML5, CSS and
  JavaScript together with a
  number of APIs to build
  apps and customize the UI.
Open Web Apps
https://developer.mozilla.org/docs/Apps/Getting_Started
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
Steps to Take
Develop Web App using
1.   HTML5, CSS, & Javascript


2.   Create an app manifest file



3.   Publish/install the app
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
1.
Develop Web App using
HTML5, CSS & JavaScript
Reuse any existing web site/app or develop from scratch with open
                          web standards.

   Utilize HTML5 features such as localStorage, offline manifest,
         IndexedDB and access Web APIs for more options.

  Responsive web design for adapting to varying resolutions and
                      screen orientation.
2.
Create an app manifest file
Create a file with a .webapp extension
{
  "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/"
        }
     },
     "it": {
        "description": "Azione aperta emozionante di sviluppo di
fotoricettore!",
        "developer": {
          "url": "http://it.mozillalabs.com/"
        }
     }
  },
  "default_locale": "en"
}
MANIFEST CHECKER
   http://appmanifest.org/
Serve with Content-type/MIME type:

application/x-web-app-manifest+json
Apache - in mime.types:

application/x-web-app-manifest+json webapp



Apache - in .htaccess:

AddType application/x-web-app-manifest+json webapp



NGinx - in mime.types:

types {
  text/html   html htm shtml;
  text/css    css;
  text/xml    xml;
  application/x-web-app-manifest+json   webapp;
}
IIS:

In IIS Manager, right-click the local
computer, and click Properties.

Click the MIME Types button.

Click New.

In the Extension box, type the file name
extension.

In the MIME type box, type a description
that exactly matches the file type defined
on the computer.

Click OK.
curl -I http://mozillalabs.com/manifest.webapp
3.
Publish/install the app
Firefox Marketplace
https://marketplace.firefox.com/
https://marketplace.firefox.com/developers/
Installing/hosting the app
var request = navigator.mozApps.install(
   "http://mozillalabs.com/MozillaBall.webapp",
   {
     user_id: "some_user"
   }
);

request.onsuccess = function() {
  // Success! Notification, launch page etc
}

request.onerror = function() {
  // Failed. this.error.name has details
}
Packaged vs. Hosted Apps
A packaged app is an Open Web App that has all of its resources
(HTML, CSS, JavaScript, app manifest, and so on) contained in a zip
       file, instead of having its resources on a Web server.

A packaged app is simply a zip file with the app manifest in its root
    directory. The manifest must be named manifest.webapp.
Can be privileged apps with more API access than hosted apps

Resources are accessed from the zip file, which is stored on the device where the
app is installed)

Enforce a specific Content Security Policy for all application content

Can embed remote content in iframes, but that content will not have access to
privileged APIs nor will it have the default CSP applied to it
https://developer.mozilla.org/docs/Apps/
          For_Web_developers
WebAPIs
https://wiki.mozilla.org/WebAPI
Security Levels
Web Content                        Certified Web App

Regular web content                Device-critical applications

Installed Web App

A regular web app

Privileged Web App

More access, more responsibility
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
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
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




                       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);
}
NOTIFICATION
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);
WEB PAYMENTS
var pay = navigator.mozPay(paymentToken);
pay.onsuccess = function (event) {
    // Weee! Money!
};
NETWORK
INFORMATION API
var connection = window.navigator.mozConnection,
    online = connection.bandwidth > 0,
    metered = connection.metered;
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 level of the ambient light in lux
    console.log(event.value);
});
window.addEventListener("lightlevel", function (event) {
    // Possible values: "normal", "bright", "dim"
    console.log(event.value);
});
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);
});
Device Storage API
Browser API
TCP Socket API
Contacts API
systemXHR




                     PRIVILEGED APIS
DEVICE STORAGE
API
var deviceStorage = navigator.getDeviceStorage("videos");
// "external", "shared", or "default".
deviceStorage.type;

// Add a file - returns DOMRequest with file name
deviceStorage.add(blob);

// Same as .add, with provided name
deviceStorage.addNamed(blob, name);

// Returns DOMRequest/non-editable File object
deviceStorage.get(name);

// Returns editable FileHandle object
deviceStorage.getEditable(name);

// Returns DOMRequest with success or failure
deviceStorage.delete(name);

// Enumerates files
deviceStorage.enumerate([directory]);

// Enumerates files as FileHandles
deviceStorage.enumerateEditable([directory]);
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;
     }
};
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")
};
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 APIS
WEBTELEPHONY
// Telephony object
var tel = navigator.mozTelephony;

// Check if the phone is muted (read/write property)
console.log(tel.muted);

// Check if the speaker is enabled (read/write property)
console.log(tel.speakerEnabled);
// Place a call
var cal = tel.dial(“123456789”);
// Receiving a call
tel.onincoming = function (event) {
    var incomingCall = event.call;

     // Get the number of the incoming call
     console.log(incomingCall.number);

     // Answer the call
     incomingCall.answer();
};

// Disconnect a call
call.hangUp();



// Iterating over calls, and taking action depending on their
changed status
tel.oncallschanged = function (event) {
    tel.calls.forEach(function (call) {
        // Log the state of each call
        console.log(call.state);
    });
};
WEBSMS
// SMS object
var sms = navigator.mozSMS;

// Send a message
sms.send("123456789", "Hello world!");
// Recieve a message
sms.onreceived = function (event) {
    // Read message
    console.log(event.message);
};
WEB ACTIVITIES
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
{
    "activities": {
        "share": {
            "filters": {
                "type": ["image/png", "image/gif"]
            }
            "href": "sharing.html",
            "disposition": "window"
        }
    }
}
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!");
};
var register = navigator.mozRegisterActivityHandler({
    name: "view",
    disposition: "inline",
    filters: {
        type: "image/png"
    }
});

register.onerror = function () {
    console.log("Failed to register activity");
}
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
});
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
Future APIs
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
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
Web Apps from Mozilla
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
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
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
https://hacks.mozilla.org/2013/01/hacking-gaia-for-firefox-
                         os-part-1/
Get started
https://addons.mozilla.org/firefox/addon/firefox-os-
                    simulator/
FIREFOX OS
                        BOILERPLATE APP



https://github.com/robnyman/Firefox-OS-Boilerplate-App
WebRTC
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
var video = document.querySelector('video');

navigator.getUserMedia = navigator.getUserMedia ||
navigator.webkitGetUserMedia || navigator.mozGetUserMedia ||
navigator.msGetUserMedia;
window.URL = window.URL || window.webkitURL || window.mozURL ||
window.msURL;

// Call the getUserMedia method with our callback functions
if (navigator.getUserMedia) {
    navigator.getUserMedia({video: true}, successCallback, errorCallback);
} else {
    console.log('Native web camera streaming (getUserMedia) not supported
in this browser.');
    // Display a friendly "sorry" message to the user
}
function successCallback(stream) {
    // Set the source of the video element with the stream from the camera
    if (video.mozSrcObject !== undefined) {
        video.mozSrcObject = stream;
    } else {
        video.src = (window.URL && window.URL.createObjectURL(stream)) ||
stream;
    }
    video.play();
}
Getting help
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
https://lists.mozilla.org/listinfo/dev-webapps

             irc://irc.mozilla.org/
               #openwebapps
Trying things out
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
 	Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland
Robert Nyman
robertnyman.com
robert@mozilla.com
Mozilla

   @robertnyman

More Related Content

What's hot (20)

PDF
JQuery UK Service Workers Talk
Natasha Rooney
 
PDF
JQuery UK February 2015: Service Workers On Vacay
Natasha Rooney
 
PDF
Connect.js - Exploring React.Native
joshcjensen
 
PDF
WebAPIs + Brick - WebBR2013
Fábio Magnoni
 
PDF
How to Win on the Apple Watch
Natasha Murashev
 
PDF
Connect.js 2015 - Building Native Mobile Applications with Javascript
joshcjensen
 
PDF
Android swedroid
Johan Nilsson
 
PDF
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
PDF
Search and play more than 50 clips
phanhung20
 
PDF
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Pavol Bielik
 
PDF
What's new in Rails 4
Fabio Akita
 
PDF
The JavaFX Ecosystem
Andres Almiray
 
PDF
Dethroning Grunt: Simple and Effective Builds with gulp.js
Jay Harris
 
PDF
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
Patrick Lauke
 
PDF
Titanium - Making the most of your single thread
Ronald Treur
 
PDF
AnkaraJUG Kasım 2012 - PrimeFaces
Ankara JUG
 
PDF
Advanced Mac Software Deployment and Configuration: Just Make It Work!
Timothy Sutton
 
PDF
developing Xul
Daewoong Kim
 
PDF
feature flagging with rails engines v0.2
Enrico Teotti
 
PPTX
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 
JQuery UK Service Workers Talk
Natasha Rooney
 
JQuery UK February 2015: Service Workers On Vacay
Natasha Rooney
 
Connect.js - Exploring React.Native
joshcjensen
 
WebAPIs + Brick - WebBR2013
Fábio Magnoni
 
How to Win on the Apple Watch
Natasha Murashev
 
Connect.js 2015 - Building Native Mobile Applications with Javascript
joshcjensen
 
Android swedroid
Johan Nilsson
 
20130528 solution linux_frousseau_nopain_webdev
Frank Rousseau
 
Search and play more than 50 clips
phanhung20
 
Finding Concurrency Errors in Event-Driven Applications - Strangeloop'14
Pavol Bielik
 
What's new in Rails 4
Fabio Akita
 
The JavaFX Ecosystem
Andres Almiray
 
Dethroning Grunt: Simple and Effective Builds with gulp.js
Jay Harris
 
HTML5 kickstart - Brooklyn Beta workshop 21.10.2010
Patrick Lauke
 
Titanium - Making the most of your single thread
Ronald Treur
 
AnkaraJUG Kasım 2012 - PrimeFaces
Ankara JUG
 
Advanced Mac Software Deployment and Configuration: Just Make It Work!
Timothy Sutton
 
developing Xul
Daewoong Kim
 
feature flagging with rails engines v0.2
Enrico Teotti
 
Testing frontends with nightwatch & saucelabs
Tudor Barbu
 

Viewers also liked (20)

PDF
0800z Royalty Finance Invitation
Michael Kaplan
 
PDF
Conexa Comunicação
Conexa Comunicação
 
PPT
Mittelstand im Mittelpunkt: High End eCommerce
Frank Hörning
 
PDF
Baso 11-ybk-final
mariagabriela79
 
PDF
Aieee pt 5 2012
a2b4c600
 
KEY
Presentación 30segons
Sergio Sánchez
 
PDF
Eleuthera island
Sloth27
 
PDF
Palmera final-22 de agosto- copia enviada a imprenta.
Hernán Poloni
 
PPTX
Lazer e Diferenciais - Ph.D Personal Home Design - Barra Funda/SP
Deise Viegas
 
PDF
Kinesis Marketing Social Media Brochure
Michael Pierre
 
DOC
Devendra_Pawar
Devendra Pawar
 
PDF
CRP0422 - Luz e Gambiarra
danigurgel
 
PPTX
Catedral slp
Cuauhtémoc Oros
 
PDF
Brazilian Pipeline Community
drihansen
 
PDF
Catalogue produits étanchéité Isocell 2016
Isocell France
 
PDF
Abogado, asesor, consultor litigante administrador de empresas inocencio mele...
M&s Consultorías Legal Entreprise Austral Group. Inocencio Meléndez Julio.
 
PDF
An introduction to Zeversolar inverters
Alternergy
 
PPT
Los tehuelches Giuli.
sugiambruni
 
PPTX
NAVIERA : AMERICAN PRESIDENT LINES (APL)
Siomi Hernández
 
0800z Royalty Finance Invitation
Michael Kaplan
 
Conexa Comunicação
Conexa Comunicação
 
Mittelstand im Mittelpunkt: High End eCommerce
Frank Hörning
 
Baso 11-ybk-final
mariagabriela79
 
Aieee pt 5 2012
a2b4c600
 
Presentación 30segons
Sergio Sánchez
 
Eleuthera island
Sloth27
 
Palmera final-22 de agosto- copia enviada a imprenta.
Hernán Poloni
 
Lazer e Diferenciais - Ph.D Personal Home Design - Barra Funda/SP
Deise Viegas
 
Kinesis Marketing Social Media Brochure
Michael Pierre
 
Devendra_Pawar
Devendra Pawar
 
CRP0422 - Luz e Gambiarra
danigurgel
 
Catedral slp
Cuauhtémoc Oros
 
Brazilian Pipeline Community
drihansen
 
Catalogue produits étanchéité Isocell 2016
Isocell France
 
Abogado, asesor, consultor litigante administrador de empresas inocencio mele...
M&s Consultorías Legal Entreprise Austral Group. Inocencio Meléndez Julio.
 
An introduction to Zeversolar inverters
Alternergy
 
Los tehuelches Giuli.
sugiambruni
 
NAVIERA : AMERICAN PRESIDENT LINES (APL)
Siomi Hernández
 
Ad

Similar to Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland (20)

PDF
WebAPIs & Apps - Mozilla London
Robert Nyman
 
PDF
Web APIs & Apps - Mozilla
Robert Nyman
 
PDF
JavaScript APIs - The Web is the Platform
Robert Nyman
 
PDF
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman
 
PDF
Mozilla, Firefox OS and the Open Web
Robert Nyman
 
PDF
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Robert Nyman
 
PDF
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Robert Nyman
 
PPTX
Introduction to Apache Cordova (Phonegap)
ejlp12
 
PPT
Firefox os-introduction
zsoltlengyelit
 
PDF
The Open Web and what it means
Robert Nyman
 
PDF
Mozilla Web Apps - Super-VanJS
Robert Nyman
 
PDF
Firefox OS
Sayak Sarkar
 
PDF
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
PDF
WebRTC & Firefox OS - presentation at Google
Robert Nyman
 
PDF
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
PPTX
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Frédéric Harper
 
PDF
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 
PPTX
HTML5 WebWorks
Raul Jimenez
 
PPTX
Firefox OS Web APIs, taking it to the next level
Frédéric Harper
 
KEY
Intro To webOS
fpatton
 
WebAPIs & Apps - Mozilla London
Robert Nyman
 
Web APIs & Apps - Mozilla
Robert Nyman
 
JavaScript APIs - The Web is the Platform
Robert Nyman
 
Firefox OS learnings & visions, WebAPIs - budapest.mobile
Robert Nyman
 
Mozilla, Firefox OS and the Open Web
Robert Nyman
 
Firefox OS, the Open Web & WebAPIs - Geek Meet Västerås
Robert Nyman
 
Firefox OS, the Open Web & WebAPIs - HTML5DevConf, San Francisco
Robert Nyman
 
Introduction to Apache Cordova (Phonegap)
ejlp12
 
Firefox os-introduction
zsoltlengyelit
 
The Open Web and what it means
Robert Nyman
 
Mozilla Web Apps - Super-VanJS
Robert Nyman
 
Firefox OS
Sayak Sarkar
 
Firefox OS, une plateforme à découvrir - IO Saglac - 2014-09-09
Frédéric Harper
 
WebRTC & Firefox OS - presentation at Google
Robert Nyman
 
HTML for the Mobile Web, Firefox OS - All Things Open - 2014-10-22
Frédéric Harper
 
Firefox OS, a startup opportunity - Mobile Startups Toronto & HTML Toronto me...
Frédéric Harper
 
Firefox OS, fixing the mobile web - FITC Toronto - 2014-04-28
Frédéric Harper
 
HTML5 WebWorks
Raul Jimenez
 
Firefox OS Web APIs, taking it to the next level
Frédéric Harper
 
Intro To webOS
fpatton
 
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 - View Source conference, Berlin 2016
Robert Nyman
 
PDF
The Future of the Web - Cold Front conference 2016
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
Android TV Introduction - Stockholm Android TV meetup
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
 
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 - View Source conference, Berlin 2016
Robert Nyman
 
The Future of the Web - Cold Front conference 2016
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
 
Android TV Introduction - Stockholm Android TV meetup
Robert Nyman
 
New improvements for web developers - frontend.fi, Helsinki
Robert Nyman
 
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Robert Nyman
 

Recently uploaded (20)

PDF
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
PPTX
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
PDF
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
PDF
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
PDF
Biography of Daniel Podor.pdf
Daniel Podor
 
PDF
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
PDF
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
PDF
Blockchain Transactions Explained For Everyone
CIFDAQ
 
PPTX
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
PDF
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
PPTX
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
PPTX
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
PDF
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
PDF
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
PDF
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
PDF
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
PDF
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
PPTX
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
PDF
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
PPTX
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 
Jak MŚP w Europie Środkowo-Wschodniej odnajdują się w świecie AI
dominikamizerska1
 
Building Search Using OpenSearch: Limitations and Workarounds
Sease
 
Fl Studio 24.2.2 Build 4597 Crack for Windows Free Download 2025
faizk77g
 
Agentic AI lifecycle for Enterprise Hyper-Automation
Debmalya Biswas
 
Biography of Daniel Podor.pdf
Daniel Podor
 
"AI Transformation: Directions and Challenges", Pavlo Shaternik
Fwdays
 
Presentation - Vibe Coding The Future of Tech
yanuarsinggih1
 
Blockchain Transactions Explained For Everyone
CIFDAQ
 
From Sci-Fi to Reality: Exploring AI Evolution
Svetlana Meissner
 
Building Real-Time Digital Twins with IBM Maximo & ArcGIS Indoors
Safe Software
 
WooCommerce Workshop: Bring Your Laptop
Laura Hartwig
 
AI Penetration Testing Essentials: A Cybersecurity Guide for 2025
defencerabbit Team
 
Newgen 2022-Forrester Newgen TEI_13 05 2022-The-Total-Economic-Impact-Newgen-...
darshakparmar
 
CIFDAQ Market Wrap for the week of 4th July 2025
CIFDAQ
 
Smart Trailers 2025 Update with History and Overview
Paul Menig
 
Empower Inclusion Through Accessible Java Applications
Ana-Maria Mihalceanu
 
Using FME to Develop Self-Service CAD Applications for a Major UK Police Force
Safe Software
 
Webinar: Introduction to LF Energy EVerest
DanBrown980551
 
"Beyond English: Navigating the Challenges of Building a Ukrainian-language R...
Fwdays
 
AUTOMATION AND ROBOTICS IN PHARMA INDUSTRY.pptx
sameeraaabegumm
 

Bringing the open web and APIs to mobile devices with Firefox OS - Whisky Web, Scotland

  • 1. Bringing the Open Web & APIs to mobile devices with Firefox OS
  • 7. Firefox OS Using HTML5, CSS and JavaScript together with a number of APIs to build apps and customize the UI.
  • 12. Develop Web App using 1. HTML5, CSS, & Javascript 2. Create an app manifest file 3. Publish/install the app
  • 14. 1. Develop Web App using HTML5, CSS & JavaScript
  • 15. Reuse any existing web site/app or develop from scratch with open web standards. Utilize HTML5 features such as localStorage, offline manifest, IndexedDB and access Web APIs for more options. Responsive web design for adapting to varying resolutions and screen orientation.
  • 16. 2. Create an app manifest file
  • 17. Create a file with a .webapp extension
  • 18. { "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/" } }, "it": { "description": "Azione aperta emozionante di sviluppo di fotoricettore!", "developer": { "url": "http://it.mozillalabs.com/" } } }, "default_locale": "en" }
  • 19. MANIFEST CHECKER http://appmanifest.org/
  • 20. Serve with Content-type/MIME type: application/x-web-app-manifest+json
  • 21. Apache - in mime.types: application/x-web-app-manifest+json webapp Apache - in .htaccess: AddType application/x-web-app-manifest+json webapp NGinx - in mime.types: types { text/html html htm shtml; text/css css; text/xml xml; application/x-web-app-manifest+json webapp; }
  • 22. IIS: In IIS Manager, right-click the local computer, and click Properties. Click the MIME Types button. Click New. In the Extension box, type the file name extension. In the MIME type box, type a description that exactly matches the file type defined on the computer. Click OK.
  • 29. var request = navigator.mozApps.install( "http://mozillalabs.com/MozillaBall.webapp", { user_id: "some_user" } ); request.onsuccess = function() { // Success! Notification, launch page etc } request.onerror = function() { // Failed. this.error.name has details }
  • 31. A packaged app is an Open Web App that has all of its resources (HTML, CSS, JavaScript, app manifest, and so on) contained in a zip file, instead of having its resources on a Web server. A packaged app is simply a zip file with the app manifest in its root directory. The manifest must be named manifest.webapp.
  • 32. Can be privileged apps with more API access than hosted apps Resources are accessed from the zip file, which is stored on the device where the app is installed) Enforce a specific Content Security Policy for all application content Can embed remote content in iframes, but that content will not have access to privileged APIs nor will it have the default CSP applied to it
  • 37. Web Content Certified Web App Regular web content Device-critical applications Installed Web App A regular web app Privileged Web App More access, more responsibility
  • 39. "permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" } }
  • 42. 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 REGULAR APIS
  • 44. 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); }
  • 46. var notification = navigator.mozNotification; notification.createNotification( "See this", "This is a notification", iconURL );
  • 48. // Portrait mode: screen.mozLockOrientation("portrait"); /* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary" */
  • 50. // 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);
  • 52. var pay = navigator.mozPay(paymentToken); pay.onsuccess = function (event) { // Weee! Money! };
  • 54. var connection = window.navigator.mozConnection, online = connection.bandwidth > 0, metered = connection.metered;
  • 56. 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); });
  • 58. window.addEventListener("devicelight", function (event) { // The level of the ambient light in lux console.log(event.value); });
  • 59. window.addEventListener("lightlevel", function (event) { // Possible values: "normal", "bright", "dim" console.log(event.value); });
  • 60. 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); });
  • 61. Device Storage API Browser API TCP Socket API Contacts API systemXHR PRIVILEGED APIS
  • 63. var deviceStorage = navigator.getDeviceStorage("videos");
  • 64. // "external", "shared", or "default". deviceStorage.type; // Add a file - returns DOMRequest with file name deviceStorage.add(blob); // Same as .add, with provided name deviceStorage.addNamed(blob, name); // Returns DOMRequest/non-editable File object deviceStorage.get(name); // Returns editable FileHandle object deviceStorage.getEditable(name); // Returns DOMRequest with success or failure deviceStorage.delete(name); // Enumerates files deviceStorage.enumerate([directory]); // Enumerates files as FileHandles deviceStorage.enumerateEditable([directory]);
  • 65. 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; } };
  • 67. 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") };
  • 68. 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 APIS
  • 70. // Telephony object var tel = navigator.mozTelephony; // Check if the phone is muted (read/write property) console.log(tel.muted); // Check if the speaker is enabled (read/write property) console.log(tel.speakerEnabled);
  • 71. // Place a call var cal = tel.dial(“123456789”);
  • 72. // Receiving a call tel.onincoming = function (event) { var incomingCall = event.call; // Get the number of the incoming call console.log(incomingCall.number); // Answer the call incomingCall.answer(); }; // Disconnect a call call.hangUp(); // Iterating over calls, and taking action depending on their changed status tel.oncallschanged = function (event) { tel.calls.forEach(function (call) { // Log the state of each call console.log(call.state); }); };
  • 74. // SMS object var sms = navigator.mozSMS; // Send a message sms.send("123456789", "Hello world!");
  • 75. // Recieve a message sms.onreceived = function (event) { // Read message console.log(event.message); };
  • 78. { "activities": { "share": { "filters": { "type": ["image/png", "image/gif"] } "href": "sharing.html", "disposition": "window" } } }
  • 79. 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!"); };
  • 80. var register = navigator.mozRegisterActivityHandler({ name: "view", disposition: "inline", filters: { type: "image/png" } }); register.onerror = function () { console.log("Failed to register activity"); }
  • 81. 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 });
  • 85. 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
  • 86. Web Apps from Mozilla
  • 88. 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
  • 93. FIREFOX OS BOILERPLATE APP https://github.com/robnyman/Firefox-OS-Boilerplate-App
  • 97. var video = document.querySelector('video'); navigator.getUserMedia = navigator.getUserMedia || navigator.webkitGetUserMedia || navigator.mozGetUserMedia || navigator.msGetUserMedia; window.URL = window.URL || window.webkitURL || window.mozURL || window.msURL; // Call the getUserMedia method with our callback functions if (navigator.getUserMedia) { navigator.getUserMedia({video: true}, successCallback, errorCallback); } else { console.log('Native web camera streaming (getUserMedia) not supported in this browser.'); // Display a friendly "sorry" message to the user }
  • 98. function successCallback(stream) { // Set the source of the video element with the stream from the camera if (video.mozSrcObject !== undefined) { video.mozSrcObject = stream; } else { video.src = (window.URL && window.URL.createObjectURL(stream)) || stream; } video.play(); }