Android Traffic statistics

Source: Internet
Author: User

Researched Android traffic stats for a while
Send a summary of their own posts

1 Android has a trafficstats class that can be directly obtained
Total accepted Traffic trafficstats.gettotalrxbytes (),
Total send Traffic trafficstats.gettotaltxbytes ());
Mobile phone GPRS receiving amount trafficstats.getmobilerxbytes () not including WiFi;
Mobile phone GPRS sending amount trafficstats.getmobiletxbytes () not including WiFi;

The total receive volume of a process trafficstats.getuidrxbytes (Uid));
The total sending volume of a process trafficstats.getuidtxbytes (Uid));

These are statistics from one boot to one shutdown.
Therefore, to do a certain program of traffic statistics, be sure to pay attention to the switch machine, and this time after the boot is the first to start the program.

2 Android on top of the Trafficstats class
The data inside the first four read/proc/net/dev


The traffic in one of the subsequent processes is statistically/proc/uid_stat/*** data

Android Traffic statistics

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.