Firefox OS
@robertnyman
Mozilla is a
global non-
profit dedicated
to putting you
in control of
your online
experience and
shaping the
future of the...
Using HTML5, CSS and
JavaScript together with a
number of APIs to build
apps and customize the UI.
Firefox OS
A walk in the park
Open Web Apps
Build excellent interfaces!
Packaged vs. Hosted Apps
WebAPIs
Security Levels
Web Content
Regular web content
Installed Web App
A regular web app
Privileged Web App
More access, more responsibility
Ce...
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"
},...
PERMISSIONS
Vibration API (W3C)
Screen Orientation
Geolocation API
Mouse Lock API (W3C)
Open WebApps
Network Information API (W3C)
Bat...
BATTERY STATUS
API
var battery = navigator.battery;
if (battery) {
var batteryLevel = Math.round(battery.level * 100) + "%",
charging = (batt...
SCREEN
ORIENTATION API
// Portrait mode:
screen.mozLockOrientation("portrait");
/*
Possible values:
"landscape"
"portrait"
"landscape-primary"
"l...
VIBRATION API
// Vibrate for one second
navigator.vibrate(1000);
// Vibration pattern [vibrationTime, pause,…]
navigator.vibrate([200, 1...
DEVICEPROXIMITY
window.addEventListener("deviceproximity", function (event) {
// Current device proximity, in centimeters
console.log(even...
AMBIENT LIGHT
EVENTS
window.addEventListener("devicelight", function (event) {
// The lux values for "dim" typically begin below 50,
// and the...
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...
var storage = navigator.getDeviceStorage("videos"),
cursor = storage.enumerate();
cursor.onerror = function() {
console.er...
WEB ACTIVITIES
Interacting with the camera
var activity = new MozActivity({
name: "view",
data: {
type: "image/png",
url: ...
}
});
activity.onsuccess = function () ...
{
"activities": {
"share": {
"filters": {
"type": ["image/png", "image/gif"]
}
"href": "sharing.html",
"disposition": "win...
navigator.mozSetMessageHandler("activity", function (a) {
var img = getImageObject();
img.src = a.source.url;
// Call a.po...
Future APIs
Resource lock API
UDP Datagram Socket API
Peer to Peer API
WebNFC
WebUSB
HTTP-cache API
Calendar API
Spellcheck API
LogAPI...
Web Apps from Mozilla
Dialer
Contacts
Settings
SMS
Web browser
Gallery
Video Player
Music Player
E-mail (POP, IMAP)
Calendar
Alarm Clock
Camera
...
Get started
https://addons.mozilla.org/firefox/addon/firefox-os-
simulator/
FIREFOX OS
BOILERPLATE APP
https://github.com/robnyman/Firefox-OS-Boilerplate-App
https://marketplace.firefox.com/
https://marketplace.firefox.com/developers/
Trying things out
Go have some fun!
Robert Nyman
robertnyman.com
robert@mozilla.com
Mozilla
@robertnyman
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Firefox OS Introduction at Bontouch
Upcoming SlideShare
Loading in...5
×

Firefox OS Introduction at Bontouch

1,094

Published on

Published in: Technology
0 Comments
2 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
1,094
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
8
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Firefox OS Introduction at Bontouch

  1. 1. Firefox OS
  2. 2. @robertnyman
  3. 3. 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
  4. 4. Using HTML5, CSS and JavaScript together with a number of APIs to build apps and customize the UI. Firefox OS
  5. 5. A walk in the park
  6. 6. Open Web Apps
  7. 7. Build excellent interfaces!
  8. 8. Packaged vs. Hosted Apps
  9. 9. WebAPIs
  10. 10. Security Levels
  11. 11. 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
  12. 12. https://wiki.mozilla.org/ WebAPI#Planned_for_initial_release_of_B2G_. 28aka_Basecamp.29
  13. 13. "permissions": { "contacts": { "description": "Required for autocompletion in the share screen", "access": "readcreate" }, "alarms": { "description": "Required to schedule notifications" } }
  14. 14. PERMISSIONS
  15. 15. 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
  16. 16. BATTERY STATUS API
  17. 17. 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); }
  18. 18. SCREEN ORIENTATION API
  19. 19. // Portrait mode: screen.mozLockOrientation("portrait"); /* Possible values: "landscape" "portrait" "landscape-primary" "landscape-secondary" "portrait-primary" "portrait-secondary" */
  20. 20. VIBRATION API
  21. 21. // 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);
  22. 22. DEVICEPROXIMITY
  23. 23. 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); });
  24. 24. AMBIENT LIGHT EVENTS
  25. 25. 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); });
  26. 26. Device Storage API Browser API TCP Socket API Contacts API systemXHR PRIVILEGED APIS
  27. 27. DEVICE STORAGE API
  28. 28. var deviceStorage = navigator.getDeviceStorage("videos");
  29. 29. // "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]);
  30. 30. 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; } };
  31. 31. WEB ACTIVITIES
  32. 32. Interacting with the camera
  33. 33. 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!"); };
  34. 34. { "activities": { "share": { "filters": { "type": ["image/png", "image/gif"] } "href": "sharing.html", "disposition": "window" } } }
  35. 35. 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 });
  36. 36. Future APIs
  37. 37. 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
  38. 38. Web Apps from Mozilla
  39. 39. 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
  40. 40. Get started
  41. 41. https://addons.mozilla.org/firefox/addon/firefox-os- simulator/
  42. 42. FIREFOX OS BOILERPLATE APP https://github.com/robnyman/Firefox-OS-Boilerplate-App
  43. 43. https://marketplace.firefox.com/
  44. 44. https://marketplace.firefox.com/developers/
  45. 45. Trying things out
  46. 46. Go have some fun!
  47. 47. Robert Nyman robertnyman.com robert@mozilla.com Mozilla @robertnyman
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×