Version: Smart Feature Phone 2.5

MozNetworkStatsManager.getSamples()

Description#

The getSamples method asynchronously queries network interface statistics. The query may be filtered by connection type and date.

A data usage chunk is a MozNetworkStatsData object representing the total number of bits received and sent during the amount of time defined by the sampleRate property.

Syntax#

var samples = getSamples(network, start, end, options);
samples.onsuccess = function() {
// do something with samples.result
}

Parameters#

network#

The origin of the data; it can be specified as wifi or mobile. If null, data measurement from both origins are merged. To know in advance which kind of origin is available, the MozNetworkStatsManager.getAvailableNetworks method returns an Array of interfaces.

start#

A Date object representing the beginning of data measurement.

end#

A Date object representing the end of data measurement.

options#

Filtering options.
NetworkStatsGetOptions is a dictionary object providing filtering options.

Return#

A DOMRequest object. If successful, the request result is a MozNetworkStats object describing the network statistics. If network stats are not available for some dates, then rxBytes and txBytes are undefined for those dates. If the filtering start date is greater than the end date, an exception is thrown.

Exceptions#

NS_ERROR_INVALID_ARG#

The filtering start date is greater than the end date.

NS_ERROR_NOT_IMPLMENTED#

Both appManifestURL and serviceType are specified at the same time in the NetworkStatsGetOptions dictionary.

InvalidNetwork#

The network must be in the return of MozNetworkStatsManager.getAvailableNetworks.