MozNetworkStatsManager.getSamples()
#
DescriptionThe 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#
Parameters#
networkThe 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.
#
startA Date object representing the beginning of data measurement.
#
endA Date object representing the end of data measurement.
#
optionsFiltering options.
NetworkStatsGetOptions is a dictionary object providing filtering options.
#
ReturnA 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_ARGThe filtering start date is greater than the end date.
#
NS_ERROR_NOT_IMPLMENTEDBoth appManifestURL and serviceType are specified at the same time in the NetworkStatsGetOptions dictionary.
#
InvalidNetworkThe network must be in the return of MozNetworkStatsManager.getAvailableNetworks.