Gathering data - The Network Information and Battery Status APIs

1,277 views
1,130 views

Published on

So far, mobile browsers have been used mainly to show info and submit forms, while native apps could access device features and information to provide something more. This is changing, indeed has already changed. In my speech I will tell you how the W3C and browser vendors are working to enable the development of Web Applications that interact with device services, and will show how to use the Network Information and Battery Status APIs in an instant messaging app for Firefox OS.

HTML5 CodeShow Roma #6: http://www.meetup.com/HTML5-CodeShow-Roma/events/161056982/

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

No Downloads
Views
Total views
1,277
On SlideShare
0
From Embeds
0
Number of Embeds
50
Actions
Shares
0
Downloads
0
Comments
0
Likes
2
Embeds 0
No embeds

No notes for slide

Gathering data - The Network Information and Battery Status APIs

  1. 1. HTML5 CodeShow Roma Gathering Data The Network Information and Battery Status APIs Francesco Iovine @franciov 27 Jan 2014
  2. 2. This was my first presentation
  3. 3. I like attending tech conferences across Europe
  4. 4. NETWORK
  5. 5. Network Information API W3C Working Draft http://www.w3.org/TR/netinfo-api/
  6. 6. Network Information API W3C Working Draft 7 June 2011 navigator.connection.type // unknown, ethernet, wifi, 2g, 3g, 4g, none
  7. 7. Network Information API W3C Working Draft 29 November 2012 navigator.connection.bandwidth navigator.connection.metered navigator.connection.onchange // MB/s // true | false
  8. 8. Network Information API Proposed new spec (January 2014) navigator.netInfo navigator.netInfo.connection navigator.netInfo.connection.type // "wifi", "cellular", "disabled" navigator.netInfo.onconnectionchange
  9. 9. Network Information API W3C Working Draft 29 November 2012 navigator.mozConnection.bandwidth W3C Working Draft 7 June 2011 navigator.connection.type
  10. 10. Network Information API Use Cases • Warn the user that doing something over cellular could cost them money • Give the user control as to whether large uploads/ downloads should happen over cellular • Prevent accidental data transfer over cellular
  11. 11. BATTERY
  12. 12. Battery Status API W3C Candidate Recommendation 8 May 2012 http://www.w3.org/TR/battery-status/
  13. 13. Battery Status API navigator.battery.charging // true or false navigator.battery.level // from 0 to 1.0 navigator.battery.chargingTime // seconds navigator.battery.dischargingTime // seconds navigator.battery.onchargingchange navigator.battery.onlevelchange navigator.battery.ondischargingtimechange
  14. 14. Battery Status API
  15. 15. http://goo.gl/87QanF
  16. 16. https://github.com/franciov/low-energy-messenger
  17. 17. Contributing • include real messenger functionality, using WebRTC or Web Sockets • better look&feel • add tests • open github issues https://github.com/franciov/low-energy-messenger
  18. 18. https://developer.mozilla.org/en-US/Apps/Developing/gather_and_modify_data/ retrieving_battery_status_information
  19. 19. Device APIs / WebAPI Network Media Recording Battery Proximity Touch Ambient Motion Contacts GPS Calendar Media Capture Vibration
  20. 20. References
  21. 21. www.w3.org/2009/dap/ www.w3.org/2009/dap/wiki/ImplementationStatus
  22. 22. http://docs.webplatform.org/wiki/apis/network_information http://docs.webplatform.org/wiki/apis/battery_status
  23. 23. https://developer.mozilla.org/en-US/docs/WebAPI
  24. 24. http://blog.codeinvaders.net http://blog.codeinvaders.net/2013/12/w3c-device-apis-1-battery-network-vibration/
  25. 25. www.francesco.iovine.name f.iovine@gmail.com @franciov Credits: Chris Mills
  26. 26. Photos http://www.flickr.com/photos/kevandotorg/5837174879 http://www.flickr.com/photos/htakashi/9754012931 http://www.flickr.com/photos/vividbreeze/480057824

×