• Skip to main content
  • Select language
  • Skip to search
mozilla
Mozilla Developer Network
  • Sign in
    • Persona
    • GitHub
  • Web Platform
    Technologies
    • HTML
    • CSS
    • JavaScript
    • Graphics
    • APIs / DOM
    • Apps
    • MathML
    References & Guides
    • Learn the Web
    • Tutorials
    • References
    • Developer Guides
    • Accessibility
    • ...more docs
  • Mozilla Docs
    • Add-ons
    • Firefox
    • Firefox Marketplace
    • Firefox OS
    • Persona
  • Developer Tools
  • Feedback
    • Get Firefox help
    • Get web development help
    • Join the MDN community
    • Report a content problem
    • Report a bug
  •  
B2G OS
    • No translations exist for this article.
    • Add a translation
  • Edit
  • Advanced
    • History
    • Print this article
  1. MDN
  2. Mozilla
  3. B2G OS
  4. Firefox OS APIs
  5. MozNetworkStatsManager
  6. MozNetworkStatsManager.getSamples()
Your Search Results

    MozNetworkStatsManager.getSamples()

    In This Article
    1. Summary
    2. Syntax
    3. Parameters
    4. Return
    5. Exceptions
    6. Specifications
    7. See also

    This article needs a technical review. How you can help.

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

    SummaryEdit

    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 amount of bits received and sent during the amount of time defined by the sampleRate property.

    SyntaxEdit

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

    ParametersEdit

    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 Optional
    Filtering options.
    NetworkStatsGetOptions is a dictionary object providing filtering options.

    ReturnEdit

    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.

    ExceptionsEdit

    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.

    SpecificationsEdit

    Not part of any specification.

    See alsoEdit

    • MozNetworkStatsManager
    • Network Stats API
    Share:
    • Twitter
    • Facebook
    • Google+

    Document Tags and Contributors

    Tags: 
    • API
    • B2G
    • Firefox OS
    • Method
    • Non-standard
    • Reference
    • Référence
     Contributors to this page: chrisdavidmills, kscarfone, zeller
     Last updated by: chrisdavidmills, Feb 11, 2016, 6:30:50 AM
    See also
    1. Network Stats API
    2. MozNetworkStatsManager
    3. Properties
      1. connectionTypes
      2. maxStorageAge
      3. maxStorageSamples
      4. sampleRate
    4. Methods
      1. addAlarm()
      2. clearAllData()
      3. clearAllStats()
      4. clearStats()
      5. getAllAlarms()
      6. getAvailableNetworks()
      7. getAvailableServiceTypes()
      8. getNetworkStats()
      9. getSamples()
      10. removeAlarms()
    5. Related pages for Network Stats API
      1. MozNetworkStats
      2. MozNetworkStatsData
      3. Navigator.mozNetworkStats

    © 2005-2016 Mozilla Developer Network and individual contributors.

    Content is available under these licenses.

    • About MDN
    • Terms
    • Privacy
    • Cookies
    • Contribute to the code

    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy
    BESbswy