Re: 答复: comments of Network Information API

On 03/21/2012 04:49 AM, 吴静 wrote:
> For example, I'm watching internet video using WiFi, but it disconnects for some reason, and the mobile reconnects internet through 3G access point, which is usually charging according to the data flow. If we failed to tell the user this change as soon as possible, the user will have a big problem when he receives his bill at the end of the month. If we have the parameter '.type', we can give users an explicit information in application when the network is switching and reconnecting.

The metered attribute should be used for the scenario you are
mentioning: when you switch to a 3G connection, an event should be fired
to let you know that the connection is now metered.
In my opinion, this solution is far better than using a type attribute
because you can imagine that .metered will return false if the user has
an unlimited 3G data plan [1] while only checking connection type will
returns false positives and false negatives.

[1] Right now, implementations will hardly be able to do better than |if
(dataConnection) return true;| but if applications are using that
attribute and implementations get better tools to check for metered
status, we could improve things and everybody will get those
improvements while using type to check that is wrong and will stay wrong
forever.

--
Mounir

Received on Wednesday, 21 March 2012 13:40:33 UTC