W3C home > Mailing lists > Public > public-device-apis@w3.org > January 2014

Re: Network Information API

From: Francesco Iovine <f.iovine@gmail.com>
Date: Fri, 17 Jan 2014 14:57:50 +0100
Message-ID: <CALE=BGRe-u5OnovKaD3j_5onpnroEeu_Zt9f966-5aefgNVxSw@mail.gmail.com>
To: Marcos Caceres <w3c@marcosc.com>
Cc: Ehsan Akhgari <ehsan@mozilla.com>, Fernando Jiménez Moreno <ferjmoreno@gmail.com>, Mats Wichmann <m.wichmann@samsung.com>, "public-device-apis@w3.org" <public-device-apis@w3.org>
Hi Marcos,

On 17 January 2014 10:44, Marcos Caceres <w3c@marcosc.com> wrote:

>
>
>
> On Thursday, January 16, 2014 at 11:06 PM, Francesco Iovine wrote:
>
> > > Unfortunately we ship this under the name navigator.mozConnection
> everywhere, but on desktop we just have a default implementation returning
> infinity for bandwidth and false for metered unconditionally.
> >
> >
> > Yes, navigator.mozConnection works quite well in Firefox for Android and
> Firefox OS.
>
> Can you clarify by what you mean by "works quite well"? Do you know of any
> example applications that are making use of this API in FxOS or Android?
>
>
>
>
Yes! I have written a demo application for the Network Information API: is
a photo-sharing Web Application that enables users to take pictures and
sync them with online services. It covers the use case of synchronizing
media data (photos in this case) in order to give the user control to
whether large uploads should happen over cellular. This demo will be part
of a MDN page explaining how to optimize a Open Web App for high and low
network speeds.

Live demo: http://goo.gl/0wP7Gm
Source: soon on github, anyway the most interesting part of the demo is
inside the NetworkManager

http://www.francesco.iovine.name/mdn/net-pics/public_html/scripts/utils/NetworkManager.js

When I say that the Network Information API "works quite well" on Firefox
for Android or FxOS I mean:

   - navigator.mozConnection exists
   - navigator.mozConnection.bandwidth returns different values for wifi
   and cellular networks, so I can retrieve the type
   - navigator.mozConnection.onchange works, even if it is not fired
   immediately

I tested the demo on Firefox Beta for Android 4 and on my ZTE Open FxOS 1.1

The demo supports the current W3C Specification
(navigator.connection.bandwidth), the previous specification
(navigator.connection.type) and the hypothetical upcoming specification
(navigator.netInfo), so it works in Firefox, Android browser and BB10
browser. It also combines the Network Information APIs with the Battery
Status APIs in order to sync only when the battery is charging or fully
charged, for instance. A feedback on the demo would be much appreciated.

Hope it helps! Let me know how I can help further!

Best ;)

Francesco <https://developer.mozilla.org/en-US/profiles/franciov>
Received on Friday, 17 January 2014 13:58:20 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 19:33:03 UTC