SlideShare une entreprise Scribd logo
1  sur  53
Télécharger pour lire hors ligne
Firefox OS
  Web APIs & Apps

                    Jan Jongboom
@janjongboom
One of the main problems that we're facing when developing mobile applications with web
technologies, is that phone specific features aren't available yet in the browser APIs. And why
would we; vibrating your desktop computer was not really an issue when the web standards
were decided upon.
To accomodate for the changing landscape parties like PhoneGap have already tried to bridge
the gap between 'native' and the web on platforms like iOS and Android;
but Mozilla is taking this one step (maybe two or three) further by proposing standardized
solutions to access phone specific APIs.
No more ‘native’




 And this is necessary because there is literally no difference between a 'native' app and a web
app. Everything on the screen,
from the e-mail client to the phone app;
and from the web browser (yes! the web browser) to the camera are written in HTML / CSS /
Javascript. And this means that APIs needed to be defined to access these features from your
shiny web app.
Decouple web and online




Another problem that we need to solve in this space is the fact that 'web' basically means
'online'. But with a mobile application you can't fully rely on a user having a data connection
at all time.
How can we adjust a current application to also be available when the user is on a plane?
Overview
           1. Oeh shiny, an overview of Web APIs
           2. Offline support
           3. First app in 5 minutes
           4. Adding 'native' capabilities
           5. And off to the market place




So here's the list of subjects that we're going to tackle in this talk:
Regular APIs
          •   Vibration                         •   PushNotifications
          •   ScreenOrientation                 •   WebFMApi
          •   GeoLocation                       •   WebPayment
          •   MouseLock                         •   IndexedDB
          •   OpenWebApps                       •   AmbientLightSensor
          •   NetworkInformation                •   ProxyimitySensor
          •   BatteryStatus                     •   Notification
          •   Alarm
          •   WebActivities



                       Yellow = Approved by W3C
These are all ‘basic’ APIs that have been proposed by Mozilla to the World Wide Web
consortium. Even better, a bunch of them have already been approved. Requires sometimes
permission.
Still requires explicit authentication
*Who has used IndexedDB?* It's very similar. The APIs are accessible via the `navigator`
object. For example, to vibrate your phone:
Or for battery information:
The list I showed you before is the list of all APIs that you can use from any web application.
However, some websites are more equal than others and thus require additional APIs
Think the phone application. Not every simple website should be able to make phone calls or
send text messages.
Jeg bruker bare
   sertifiserte
      API’er!




These are the 'certified' APIs. They go through the same W3C process as the other APIs but
require your app to be certified.
Certified APIs
•   WebTelephony          •   WebBluetooth
•   WebSMS                •   PermissionsAPI
•   IdleAPI               •   NetworkStatsAPI
•   SettingsAPI           •   CameraAPI
•   PowerManagementAPI    •   Time/ClockAPI
•   MobileConnectionAPI   •   Attentionscreen
•   WiFiInformationAPI    •   Voicemail




         Requires certification process
Webactivities
                               Connecting apps

Webactivities are a way to loosely couple applications to eachother. They work in a pub/sub
way where every application can register itself as a listener for certain activities.
Hey I need an
                                                image!




              Sure, I can provide
                you with one!


For example, the camera application will register itself as 'hey I can provide images'. When
your application needs an image from the user,
Web activities




the user will be provided with the choice between all applications (camera, gallery, yourapp)
that provide that. This can not only go for media, but in the future also for choosing which
phone app should be used to dial, or which web browser to surf.
I NEED AN ADULT!
Because when you start devving this you might need some help ('i need an adult' image)
https://developer.mozilla.org/en-US/docs/WebAPI

every API has been described in detail in the Mozilla MDN documentation.
Offline




Offline is a hard problem to solve. Web applications are mostly built for connectivity but that
is not always available on your shiny phone.
Dealing with offline

           • Have the necessary application files
               available
           • Cache server side data
           • Store app state on device


Data can be expensive, people are roaming, etc. The ways that you have to deal with offline
usage is:
Two types of apps

           • Hosted
            • Assets on the server
            • Cacheable via appcache
           • Packaged
            • ZIP archive with assets

Withing Firefox OS there are two types of apps that you can develop:

1. Hosted apps, that have their assets on a server; cachable via appcache
2. Packaged apps; that are a zip archive
Caching with appcache
The web browser will now fetch your whole page, then read the appcache and load all
resources described there.
ZIP

           • One big zip file
           • Resources loaded from zip file
           • Still requires manifest file


The zip approach doesn't require this but has all dependencies in the zip archive.
The app manifest file

      • Part of your packaged app
      • Has metadata (name, description, version)
      • Can define required permissions

https://marketplace.firefox.com/developers/docs/manifests
web = default app, permissions limited to open web api’s specified in there
priviliged = has to go through app store review process, has access to some more sensitive
api’s
certified = system critical apps
web = default app, permissions limited to open web api’s specified in there
priviliged = has to go through app store review process, has access to some more sensitive
api’s
certified = system critical apps
web = default app, permissions limited to open web api’s specified in there
priviliged = has to go through app store review process, has access to some more sensitive
api’s
certified = system critical apps
web = default app, permissions limited to open web api’s specified in there
priviliged = has to go through app store review process, has access to some more sensitive
api’s
certified = system critical apps
Storing data

           • Local Storage
           • IndexedDB
           • Limited storage!
            • Manifest file can increase

For storing data rely on local storage or IndexedDB, which has limited storage but these limits
can be improved by specifying this in the manifest file.
Writing first app




Let's get this thing rolling. [Mortar](https://github.com/mozilla/mortar) is a set of projects
that can bootstrap you in creating Web Apps.
Mortar

           • HTML5 Web App
           • Files
           • Caching
           • Manifest
           • Everything to get started fast!

It does not only contain all relevant files for your project, but also does the caching for you
and has the manifest files that are required to get your app in the marketplace.
The application now runs and you can use any browser to access the application and start
using it.
Mortar contains stubs for applications, a game, list-detail views, and tab view. These samples
are ready and free to use, and very easy to manipulate into your own application.
Of course, everyone has the emulator installed; so let's go into Firefox. Tools -> Web
Developer -> Firefox OS.
The emulator shows up and the easiest way to get started: unlock the phone and click the
browser icon, go to http://localhost:8008. This is it. Your app now runs in the emulator.
Debugging time

           • Install Firefox Nightly and go to the app
               page, debug with default tools
           • Remote connection via emulator
            • This breaks often!
           • Weinre

Because your app is 'just another' web application, we can use the default firefox developer
tools to debug the application. You can do this from two sources.
Connect to emulator
          • Go to about:config
           • Toggle devtools.debugger.remote-enabled
          • In the emulator
           • Settings -> Device Information -> More
                 information -> Developer
             • Toggle ‘Remote debugging’

about:config devtools.debugger.remote-enabled true
This doesn’t work on recent builds of the debugger, and breaks often. Doesnt work on real
device.
https://github.com/robnyman/
               Firefox-OS-Boilerplate-App




So your app runs on the emulator, but it doesn't use any capabilities that Firefox OS offers
additionally. Here is https://github.com/robnyman/Firefox-OS-Boilerplate-App
Get hacking!
Questions?




github.com/janjongboom

Contenu connexe

Tendances

Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentEngin Hatay
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationMuhammad Hakim A
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGapDotitude
 
Wikipedia Mobile App with PhoneGap
Wikipedia Mobile App with PhoneGapWikipedia Mobile App with PhoneGap
Wikipedia Mobile App with PhoneGapTed Chien
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikMukteswar Patnaik
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with FlexConFoo
 
Introduction to Hybrid Application Development
Introduction to Hybrid Application DevelopmentIntroduction to Hybrid Application Development
Introduction to Hybrid Application DevelopmentDotitude
 
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSCordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSGabriel Huecas
 
HTML5 로 iPhone App 만들기
HTML5 로 iPhone App 만들기HTML5 로 iPhone App 만들기
HTML5 로 iPhone App 만들기JungHyuk Kwon
 
BBM Social Platform and App Monetization
BBM Social Platform and App MonetizationBBM Social Platform and App Monetization
BBM Social Platform and App MonetizationKyle McInnes
 
SD Forum Java SIG - Service Oriented UI Architecture
SD Forum Java SIG - Service Oriented UI ArchitectureSD Forum Java SIG - Service Oriented UI Architecture
SD Forum Java SIG - Service Oriented UI ArchitectureJeff Haynie
 
Building a mobile application for dot netnuke
Building a mobile application for dot netnukeBuilding a mobile application for dot netnuke
Building a mobile application for dot netnukebrchapman
 
Introduction of Mobile applications
Introduction of Mobile applicationsIntroduction of Mobile applications
Introduction of Mobile applicationsAkib B. Momin
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application developmentKnoldus Inc.
 
Open Source World : Using Web Technologies to build native iPhone and Android...
Open Source World : Using Web Technologies to build native iPhone and Android...Open Source World : Using Web Technologies to build native iPhone and Android...
Open Source World : Using Web Technologies to build native iPhone and Android...Jeff Haynie
 
Cross platform mobile web apps
Cross platform mobile web appsCross platform mobile web apps
Cross platform mobile web appsJames Pearce
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Mark Leusink
 
Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Matheus Cardoso
 

Tendances (20)

Phonegap
PhonegapPhonegap
Phonegap
 
DDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su LotusDDive- Giuseppe Grasso - mobile su Lotus
DDive- Giuseppe Grasso - mobile su Lotus
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Phonegap/Cordova vs Native Application
Phonegap/Cordova vs Native ApplicationPhonegap/Cordova vs Native Application
Phonegap/Cordova vs Native Application
 
Hybrid App Development with PhoneGap
Hybrid App Development with PhoneGapHybrid App Development with PhoneGap
Hybrid App Development with PhoneGap
 
Wikipedia Mobile App with PhoneGap
Wikipedia Mobile App with PhoneGapWikipedia Mobile App with PhoneGap
Wikipedia Mobile App with PhoneGap
 
Xamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar PatnaikXamarin COE by Mukteswar Patnaik
Xamarin COE by Mukteswar Patnaik
 
Develop mobile applications with Flex
Develop mobile applications with FlexDevelop mobile applications with Flex
Develop mobile applications with Flex
 
Introduction to Hybrid Application Development
Introduction to Hybrid Application DevelopmentIntroduction to Hybrid Application Development
Introduction to Hybrid Application Development
 
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSSCordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
 
HTML5 로 iPhone App 만들기
HTML5 로 iPhone App 만들기HTML5 로 iPhone App 만들기
HTML5 로 iPhone App 만들기
 
BBM Social Platform and App Monetization
BBM Social Platform and App MonetizationBBM Social Platform and App Monetization
BBM Social Platform and App Monetization
 
SD Forum Java SIG - Service Oriented UI Architecture
SD Forum Java SIG - Service Oriented UI ArchitectureSD Forum Java SIG - Service Oriented UI Architecture
SD Forum Java SIG - Service Oriented UI Architecture
 
Building a mobile application for dot netnuke
Building a mobile application for dot netnukeBuilding a mobile application for dot netnuke
Building a mobile application for dot netnuke
 
Introduction of Mobile applications
Introduction of Mobile applicationsIntroduction of Mobile applications
Introduction of Mobile applications
 
Hybrid application development
Hybrid application developmentHybrid application development
Hybrid application development
 
Open Source World : Using Web Technologies to build native iPhone and Android...
Open Source World : Using Web Technologies to build native iPhone and Android...Open Source World : Using Web Technologies to build native iPhone and Android...
Open Source World : Using Web Technologies to build native iPhone and Android...
 
Cross platform mobile web apps
Cross platform mobile web appsCross platform mobile web apps
Cross platform mobile web apps
 
Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)Creating mobile apps - an introduction to Ionic (Engage 2016)
Creating mobile apps - an introduction to Ionic (Engage 2016)
 
Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!Ionic Framework: Let's build amazing apps. No Excuses!
Ionic Framework: Let's build amazing apps. No Excuses!
 

En vedette

Firefox OS Apps & Apis - WebRebels App day 2013
Firefox OS Apps & Apis - WebRebels App day 2013Firefox OS Apps & Apis - WebRebels App day 2013
Firefox OS Apps & Apis - WebRebels App day 2013Jan Jongboom
 
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...Jan Jongboom
 
HTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for ChangeHTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for ChangeJan Jongboom
 
From HTML5 to Hardware - Simonyi Conference Budapest April 15
From HTML5 to Hardware - Simonyi Conference Budapest April 15From HTML5 to Hardware - Simonyi Conference Budapest April 15
From HTML5 to Hardware - Simonyi Conference Budapest April 15Jan Jongboom
 
Firefox OS, the Open Web & WebAPIs - LXJS, Portugal
Firefox OS, the Open Web & WebAPIs - LXJS, PortugalFirefox OS, the Open Web & WebAPIs - LXJS, Portugal
Firefox OS, the Open Web & WebAPIs - LXJS, PortugalRobert Nyman
 

En vedette (9)

Mozilla's Boot to Gecko (B2G)
Mozilla's Boot to Gecko (B2G)Mozilla's Boot to Gecko (B2G)
Mozilla's Boot to Gecko (B2G)
 
Firefox OS Apps & Apis - WebRebels App day 2013
Firefox OS Apps & Apis - WebRebels App day 2013Firefox OS Apps & Apis - WebRebels App day 2013
Firefox OS Apps & Apis - WebRebels App day 2013
 
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
Firefox OS Apps & APIs - Dutch Mobile Conference / Serbia & Montenegro App da...
 
HTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for ChangeHTML5 for mobile - DiGi Challenge for Change
HTML5 for mobile - DiGi Challenge for Change
 
From HTML5 to Hardware - Simonyi Conference Budapest April 15
From HTML5 to Hardware - Simonyi Conference Budapest April 15From HTML5 to Hardware - Simonyi Conference Budapest April 15
From HTML5 to Hardware - Simonyi Conference Budapest April 15
 
Diabetes
DiabetesDiabetes
Diabetes
 
Firefox OS, the Open Web & WebAPIs - LXJS, Portugal
Firefox OS, the Open Web & WebAPIs - LXJS, PortugalFirefox OS, the Open Web & WebAPIs - LXJS, Portugal
Firefox OS, the Open Web & WebAPIs - LXJS, Portugal
 
Mozilla Jordan in the Arabic Mozilla Regional Meeting
Mozilla Jordan in the Arabic Mozilla Regional MeetingMozilla Jordan in the Arabic Mozilla Regional Meeting
Mozilla Jordan in the Arabic Mozilla Regional Meeting
 
Fork me!
Fork me!Fork me!
Fork me!
 

Similaire à Webapi

PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the FutureTim Kim
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDee Sadler
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaShekhar Gulati
 
Intro to tech stacks bonny
Intro to tech stacks bonnyIntro to tech stacks bonny
Intro to tech stacks bonnyLama K Banna
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applicationsFDConf
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Jan Jongboom
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentÖzcan Zafer AYAN
 
Consider Starting Small
Consider Starting SmallConsider Starting Small
Consider Starting SmallAndrew Smith
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An IntroductionTyler Johnston
 
Cross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceCross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceAll Things Open
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGapRamesh Nair
 
Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and Ryan Cuprak
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaChristian Heilmann
 
Introduction to hybrid application development
Introduction to hybrid application developmentIntroduction to hybrid application development
Introduction to hybrid application developmentKunjan Thakkar
 
Device APIs at TakeOff Conference
Device APIs at TakeOff ConferenceDevice APIs at TakeOff Conference
Device APIs at TakeOff Conferencedianacheng
 

Similaire à Webapi (20)

Firefox OS Weekend
Firefox OS WeekendFirefox OS Weekend
Firefox OS Weekend
 
PhoneGap - Now and the Future
PhoneGap - Now and the FuturePhoneGap - Now and the Future
PhoneGap - Now and the Future
 
Dreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile designDreamweaver CS6, jQuery, PhoneGap, mobile design
Dreamweaver CS6, jQuery, PhoneGap, mobile design
 
Developing Great Apps with Apache Cordova
Developing Great Apps with Apache CordovaDeveloping Great Apps with Apache Cordova
Developing Great Apps with Apache Cordova
 
Intro to tech stacks bonny
Intro to tech stacks bonnyIntro to tech stacks bonny
Intro to tech stacks bonny
 
Offline of web applications
Offline of web applicationsOffline of web applications
Offline of web applications
 
Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014Offline for web - Frontend Dev Conf Minsk 2014
Offline for web - Frontend Dev Conf Minsk 2014
 
Intro to PhoneGap
Intro to PhoneGapIntro to PhoneGap
Intro to PhoneGap
 
Introduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App DevelopmentIntroduction to Cross-Platform Hybrid Mobile App Development
Introduction to Cross-Platform Hybrid Mobile App Development
 
Consider Starting Small
Consider Starting SmallConsider Starting Small
Consider Starting Small
 
Phonegap - An Introduction
Phonegap - An IntroductionPhonegap - An Introduction
Phonegap - An Introduction
 
Cross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open SourceCross-platform Mobile Development on Open Source
Cross-platform Mobile Development on Open Source
 
Introduction to PhoneGap
Introduction to PhoneGapIntroduction to PhoneGap
Introduction to PhoneGap
 
Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and Hybrid Mobile Development with Apache Cordova and
Hybrid Mobile Development with Apache Cordova and
 
Fixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World RomaniaFixing the mobile web - Internet World Romania
Fixing the mobile web - Internet World Romania
 
Introduction to hybrid application development
Introduction to hybrid application developmentIntroduction to hybrid application development
Introduction to hybrid application development
 
Hybrid Mobile App
Hybrid Mobile AppHybrid Mobile App
Hybrid Mobile App
 
Hybrid mobile app
Hybrid mobile appHybrid mobile app
Hybrid mobile app
 
PhoneGap/Cordova
PhoneGap/CordovaPhoneGap/Cordova
PhoneGap/Cordova
 
Device APIs at TakeOff Conference
Device APIs at TakeOff ConferenceDevice APIs at TakeOff Conference
Device APIs at TakeOff Conference
 

Plus de Jan Jongboom

TinyML on Arduino - workshop
TinyML on Arduino - workshopTinyML on Arduino - workshop
TinyML on Arduino - workshopJan Jongboom
 
Intelligent Edge - Getting started with TinyML for industrial applications
Intelligent Edge - Getting started with TinyML for industrial applicationsIntelligent Edge - Getting started with TinyML for industrial applications
Intelligent Edge - Getting started with TinyML for industrial applicationsJan Jongboom
 
Teaching your sensors new tricks with Machine Learning - Eta Compute webinar
Teaching your sensors new tricks with Machine Learning - Eta Compute webinarTeaching your sensors new tricks with Machine Learning - Eta Compute webinar
Teaching your sensors new tricks with Machine Learning - Eta Compute webinarJan Jongboom
 
Get started with TinyML - Embedded online conference
Get started with TinyML - Embedded online conferenceGet started with TinyML - Embedded online conference
Get started with TinyML - Embedded online conferenceJan Jongboom
 
Adding intelligence to your LoRaWAN deployment - The Things Virtual Conference
Adding intelligence to your LoRaWAN deployment - The Things Virtual ConferenceAdding intelligence to your LoRaWAN deployment - The Things Virtual Conference
Adding intelligence to your LoRaWAN deployment - The Things Virtual ConferenceJan Jongboom
 
Get started with TinyML - Hackster webinar 9 April 2020
Get started with TinyML - Hackster webinar 9 April 2020Get started with TinyML - Hackster webinar 9 April 2020
Get started with TinyML - Hackster webinar 9 April 2020Jan Jongboom
 
Tiny intelligent computers and sensors - Open Hardware Event 2020
Tiny intelligent computers and sensors - Open Hardware Event 2020Tiny intelligent computers and sensors - Open Hardware Event 2020
Tiny intelligent computers and sensors - Open Hardware Event 2020Jan Jongboom
 
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019Jan Jongboom
 
Adding intelligence to your LoRaWAN devices - The Things Conference on tour
Adding intelligence to your LoRaWAN devices - The Things Conference on tourAdding intelligence to your LoRaWAN devices - The Things Conference on tour
Adding intelligence to your LoRaWAN devices - The Things Conference on tourJan Jongboom
 
Machine learning on 1 square centimeter - Emerce Next 2019
Machine learning on 1 square centimeter - Emerce Next 2019Machine learning on 1 square centimeter - Emerce Next 2019
Machine learning on 1 square centimeter - Emerce Next 2019Jan Jongboom
 
Fundamentals of IoT - Data Science Africa 2019
Fundamentals of IoT - Data Science Africa 2019Fundamentals of IoT - Data Science Africa 2019
Fundamentals of IoT - Data Science Africa 2019Jan Jongboom
 
17,000 contributions in 32K RAM - FOSS North 2019
17,000 contributions in 32K RAM - FOSS North 201917,000 contributions in 32K RAM - FOSS North 2019
17,000 contributions in 32K RAM - FOSS North 2019Jan Jongboom
 
Open Hours: Mbed Simulator
Open Hours: Mbed SimulatorOpen Hours: Mbed Simulator
Open Hours: Mbed SimulatorJan Jongboom
 
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OS
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OSEfficient IoT solutions based on LoRaWAN, The Things Network and Mbed OS
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OSJan Jongboom
 
Machine learning on 1 cm2 - Tweakers Dev Summit
Machine learning on 1 cm2 - Tweakers Dev SummitMachine learning on 1 cm2 - Tweakers Dev Summit
Machine learning on 1 cm2 - Tweakers Dev SummitJan Jongboom
 
Simulating LoRaWAN devices - LoRa Alliance AMM 2019
Simulating LoRaWAN devices - LoRa Alliance AMM 2019Simulating LoRaWAN devices - LoRa Alliance AMM 2019
Simulating LoRaWAN devices - LoRa Alliance AMM 2019Jan Jongboom
 
Develop with Mbed OS - The Things Conference 2019
Develop with Mbed OS - The Things Conference 2019Develop with Mbed OS - The Things Conference 2019
Develop with Mbed OS - The Things Conference 2019Jan Jongboom
 
Firmware Updates over LoRaWAN - The Things Conference 2019
Firmware Updates over LoRaWAN - The Things Conference 2019Firmware Updates over LoRaWAN - The Things Conference 2019
Firmware Updates over LoRaWAN - The Things Conference 2019Jan Jongboom
 
Faster Device Development - GSMA @ CES 2019
Faster Device Development - GSMA @ CES 2019Faster Device Development - GSMA @ CES 2019
Faster Device Development - GSMA @ CES 2019Jan Jongboom
 
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM Tokyo
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM TokyoMbed LoRaWAN stack: a case study - LoRa Alliance AMM Tokyo
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM TokyoJan Jongboom
 

Plus de Jan Jongboom (20)

TinyML on Arduino - workshop
TinyML on Arduino - workshopTinyML on Arduino - workshop
TinyML on Arduino - workshop
 
Intelligent Edge - Getting started with TinyML for industrial applications
Intelligent Edge - Getting started with TinyML for industrial applicationsIntelligent Edge - Getting started with TinyML for industrial applications
Intelligent Edge - Getting started with TinyML for industrial applications
 
Teaching your sensors new tricks with Machine Learning - Eta Compute webinar
Teaching your sensors new tricks with Machine Learning - Eta Compute webinarTeaching your sensors new tricks with Machine Learning - Eta Compute webinar
Teaching your sensors new tricks with Machine Learning - Eta Compute webinar
 
Get started with TinyML - Embedded online conference
Get started with TinyML - Embedded online conferenceGet started with TinyML - Embedded online conference
Get started with TinyML - Embedded online conference
 
Adding intelligence to your LoRaWAN deployment - The Things Virtual Conference
Adding intelligence to your LoRaWAN deployment - The Things Virtual ConferenceAdding intelligence to your LoRaWAN deployment - The Things Virtual Conference
Adding intelligence to your LoRaWAN deployment - The Things Virtual Conference
 
Get started with TinyML - Hackster webinar 9 April 2020
Get started with TinyML - Hackster webinar 9 April 2020Get started with TinyML - Hackster webinar 9 April 2020
Get started with TinyML - Hackster webinar 9 April 2020
 
Tiny intelligent computers and sensors - Open Hardware Event 2020
Tiny intelligent computers and sensors - Open Hardware Event 2020Tiny intelligent computers and sensors - Open Hardware Event 2020
Tiny intelligent computers and sensors - Open Hardware Event 2020
 
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019
Teaching your sensors new tricks with Machine Learning - CENSIS Tech Summit 2019
 
Adding intelligence to your LoRaWAN devices - The Things Conference on tour
Adding intelligence to your LoRaWAN devices - The Things Conference on tourAdding intelligence to your LoRaWAN devices - The Things Conference on tour
Adding intelligence to your LoRaWAN devices - The Things Conference on tour
 
Machine learning on 1 square centimeter - Emerce Next 2019
Machine learning on 1 square centimeter - Emerce Next 2019Machine learning on 1 square centimeter - Emerce Next 2019
Machine learning on 1 square centimeter - Emerce Next 2019
 
Fundamentals of IoT - Data Science Africa 2019
Fundamentals of IoT - Data Science Africa 2019Fundamentals of IoT - Data Science Africa 2019
Fundamentals of IoT - Data Science Africa 2019
 
17,000 contributions in 32K RAM - FOSS North 2019
17,000 contributions in 32K RAM - FOSS North 201917,000 contributions in 32K RAM - FOSS North 2019
17,000 contributions in 32K RAM - FOSS North 2019
 
Open Hours: Mbed Simulator
Open Hours: Mbed SimulatorOpen Hours: Mbed Simulator
Open Hours: Mbed Simulator
 
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OS
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OSEfficient IoT solutions based on LoRaWAN, The Things Network and Mbed OS
Efficient IoT solutions based on LoRaWAN, The Things Network and Mbed OS
 
Machine learning on 1 cm2 - Tweakers Dev Summit
Machine learning on 1 cm2 - Tweakers Dev SummitMachine learning on 1 cm2 - Tweakers Dev Summit
Machine learning on 1 cm2 - Tweakers Dev Summit
 
Simulating LoRaWAN devices - LoRa Alliance AMM 2019
Simulating LoRaWAN devices - LoRa Alliance AMM 2019Simulating LoRaWAN devices - LoRa Alliance AMM 2019
Simulating LoRaWAN devices - LoRa Alliance AMM 2019
 
Develop with Mbed OS - The Things Conference 2019
Develop with Mbed OS - The Things Conference 2019Develop with Mbed OS - The Things Conference 2019
Develop with Mbed OS - The Things Conference 2019
 
Firmware Updates over LoRaWAN - The Things Conference 2019
Firmware Updates over LoRaWAN - The Things Conference 2019Firmware Updates over LoRaWAN - The Things Conference 2019
Firmware Updates over LoRaWAN - The Things Conference 2019
 
Faster Device Development - GSMA @ CES 2019
Faster Device Development - GSMA @ CES 2019Faster Device Development - GSMA @ CES 2019
Faster Device Development - GSMA @ CES 2019
 
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM Tokyo
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM TokyoMbed LoRaWAN stack: a case study - LoRa Alliance AMM Tokyo
Mbed LoRaWAN stack: a case study - LoRa Alliance AMM Tokyo
 

Webapi

  • 1. Firefox OS Web APIs & Apps Jan Jongboom
  • 3. One of the main problems that we're facing when developing mobile applications with web technologies, is that phone specific features aren't available yet in the browser APIs. And why would we; vibrating your desktop computer was not really an issue when the web standards were decided upon.
  • 4. To accomodate for the changing landscape parties like PhoneGap have already tried to bridge the gap between 'native' and the web on platforms like iOS and Android;
  • 5. but Mozilla is taking this one step (maybe two or three) further by proposing standardized solutions to access phone specific APIs.
  • 6. No more ‘native’ And this is necessary because there is literally no difference between a 'native' app and a web app. Everything on the screen,
  • 7. from the e-mail client to the phone app;
  • 8. and from the web browser (yes! the web browser) to the camera are written in HTML / CSS / Javascript. And this means that APIs needed to be defined to access these features from your shiny web app.
  • 9. Decouple web and online Another problem that we need to solve in this space is the fact that 'web' basically means 'online'. But with a mobile application you can't fully rely on a user having a data connection at all time.
  • 10. How can we adjust a current application to also be available when the user is on a plane?
  • 11. Overview 1. Oeh shiny, an overview of Web APIs 2. Offline support 3. First app in 5 minutes 4. Adding 'native' capabilities 5. And off to the market place So here's the list of subjects that we're going to tackle in this talk:
  • 12. Regular APIs • Vibration • PushNotifications • ScreenOrientation • WebFMApi • GeoLocation • WebPayment • MouseLock • IndexedDB • OpenWebApps • AmbientLightSensor • NetworkInformation • ProxyimitySensor • BatteryStatus • Notification • Alarm • WebActivities Yellow = Approved by W3C These are all ‘basic’ APIs that have been proposed by Mozilla to the World Wide Web consortium. Even better, a bunch of them have already been approved. Requires sometimes permission.
  • 13. Still requires explicit authentication
  • 14. *Who has used IndexedDB?* It's very similar. The APIs are accessible via the `navigator` object. For example, to vibrate your phone:
  • 15. Or for battery information:
  • 16. The list I showed you before is the list of all APIs that you can use from any web application. However, some websites are more equal than others and thus require additional APIs
  • 17. Think the phone application. Not every simple website should be able to make phone calls or send text messages.
  • 18. Jeg bruker bare sertifiserte API’er! These are the 'certified' APIs. They go through the same W3C process as the other APIs but require your app to be certified.
  • 19. Certified APIs • WebTelephony • WebBluetooth • WebSMS • PermissionsAPI • IdleAPI • NetworkStatsAPI • SettingsAPI • CameraAPI • PowerManagementAPI • Time/ClockAPI • MobileConnectionAPI • Attentionscreen • WiFiInformationAPI • Voicemail Requires certification process
  • 20. Webactivities Connecting apps Webactivities are a way to loosely couple applications to eachother. They work in a pub/sub way where every application can register itself as a listener for certain activities.
  • 21. Hey I need an image! Sure, I can provide you with one! For example, the camera application will register itself as 'hey I can provide images'. When your application needs an image from the user,
  • 22. Web activities the user will be provided with the choice between all applications (camera, gallery, yourapp) that provide that. This can not only go for media, but in the future also for choosing which phone app should be used to dial, or which web browser to surf.
  • 23. I NEED AN ADULT! Because when you start devving this you might need some help ('i need an adult' image)
  • 24. https://developer.mozilla.org/en-US/docs/WebAPI every API has been described in detail in the Mozilla MDN documentation.
  • 25. Offline Offline is a hard problem to solve. Web applications are mostly built for connectivity but that is not always available on your shiny phone.
  • 26. Dealing with offline • Have the necessary application files available • Cache server side data • Store app state on device Data can be expensive, people are roaming, etc. The ways that you have to deal with offline usage is:
  • 27. Two types of apps • Hosted • Assets on the server • Cacheable via appcache • Packaged • ZIP archive with assets Withing Firefox OS there are two types of apps that you can develop: 1. Hosted apps, that have their assets on a server; cachable via appcache 2. Packaged apps; that are a zip archive
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34. The web browser will now fetch your whole page, then read the appcache and load all resources described there.
  • 35. ZIP • One big zip file • Resources loaded from zip file • Still requires manifest file The zip approach doesn't require this but has all dependencies in the zip archive.
  • 36. The app manifest file • Part of your packaged app • Has metadata (name, description, version) • Can define required permissions https://marketplace.firefox.com/developers/docs/manifests
  • 37. web = default app, permissions limited to open web api’s specified in there priviliged = has to go through app store review process, has access to some more sensitive api’s certified = system critical apps
  • 38. web = default app, permissions limited to open web api’s specified in there priviliged = has to go through app store review process, has access to some more sensitive api’s certified = system critical apps
  • 39. web = default app, permissions limited to open web api’s specified in there priviliged = has to go through app store review process, has access to some more sensitive api’s certified = system critical apps
  • 40. web = default app, permissions limited to open web api’s specified in there priviliged = has to go through app store review process, has access to some more sensitive api’s certified = system critical apps
  • 41. Storing data • Local Storage • IndexedDB • Limited storage! • Manifest file can increase For storing data rely on local storage or IndexedDB, which has limited storage but these limits can be improved by specifying this in the manifest file.
  • 42. Writing first app Let's get this thing rolling. [Mortar](https://github.com/mozilla/mortar) is a set of projects that can bootstrap you in creating Web Apps.
  • 43. Mortar • HTML5 Web App • Files • Caching • Manifest • Everything to get started fast! It does not only contain all relevant files for your project, but also does the caching for you and has the manifest files that are required to get your app in the marketplace.
  • 44. The application now runs and you can use any browser to access the application and start using it.
  • 45. Mortar contains stubs for applications, a game, list-detail views, and tab view. These samples are ready and free to use, and very easy to manipulate into your own application.
  • 46. Of course, everyone has the emulator installed; so let's go into Firefox. Tools -> Web Developer -> Firefox OS.
  • 47. The emulator shows up and the easiest way to get started: unlock the phone and click the browser icon, go to http://localhost:8008. This is it. Your app now runs in the emulator.
  • 48. Debugging time • Install Firefox Nightly and go to the app page, debug with default tools • Remote connection via emulator • This breaks often! • Weinre Because your app is 'just another' web application, we can use the default firefox developer tools to debug the application. You can do this from two sources.
  • 49. Connect to emulator • Go to about:config • Toggle devtools.debugger.remote-enabled • In the emulator • Settings -> Device Information -> More information -> Developer • Toggle ‘Remote debugging’ about:config devtools.debugger.remote-enabled true
  • 50. This doesn’t work on recent builds of the debugger, and breaks often. Doesnt work on real device.
  • 51. https://github.com/robnyman/ Firefox-OS-Boilerplate-App So your app runs on the emulator, but it doesn't use any capabilities that Firefox OS offers additionally. Here is https://github.com/robnyman/Firefox-OS-Boilerplate-App