mozilla

MozNetworkStatsManager

This article is in need of a technical review.

Non-standard
This feature is not on a current W3C standards track, but it is supported on the Firefox OS platform. Although implementations may change in the future and it is not supported widely across browsers, it is suitable for use in code dedicated to Firefox OS apps.

This API is available on Firefox OS for internal applications only.

Summary

The MozNetworkStatsManager interface provides methods and properties to monitor data usage.

Properties

MozNetworkStatsManager.maxStorageAge Read only
A number representing the time in milliseconds recorded by the API until present time for each type of connection. All samples older than maxStorageAge from now are deleted.
MozNetworkStatsManager.sampleRate Read only
A number representing the minimum time in milliseconds between samples stored in the database.

Methods

MozNetworkStatsManager.addAlarm()
Allows to install an alarm on a network. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.clearAllStats()
Allows to clear all the statistics about the data usage. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.clearStats()
Allows to clear all the statistics about the data usage on a specific network. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.getAllAlarms()
Allows to obtain all alarms for those networks returned by MozNetworkStatsManager.getAvailableNetworks. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.getAvailableNetworks()
Allows to obtain an Array of available networks that used to be saved in the database. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.getAvailableServiceTypes()
Allows to obtain an Array of available service types that used to be saved in the database. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.getSamples()
Allows to access the data usage statistics. Returns a DOMRequest object to handle the success or failure of the request.
MozNetworkStatsManager.removeAlarms()
Allows to remove all network alarms, or a specific network alarm, if an alarmId is provided. Returns a DOMRequest object to handle the success or failure of the request.

Constants

MozNetworkStatsManager.WIFI
Returns 0, identifying Wifi
MozNetworkStatsManager.MOBILE
Returns 1, identifying Mobile

Specification

Not part of any specification.

See also

Document Tags and Contributors

Contributors to this page: fscholz, Jeremie, teoli, jsx, kscarfone, zeller
Last updated by: zeller,