Public void getapptrafficlist () {// obtain information about all application software installed on the mobile phone and obtain the permission information packagemanager PM = getpackagemanager () in these software (); // obtain system application package management // obtain androidmanifest in each package. XML Information, its permissions, and so on list <packageinfo> pinfos = PM. getinstalledpackages (packagemanager. get_uninstalled_packages | packagemanager. get_permissions); // traverse each application package information for (packageinfo info: pinfos) {// request androidmanifest corresponding to each package. permission in XML string [] premissions = info. requestedper Missions; If (premissions! = NULL & premissions. length> 0) {// find the application for network services (string premission: premissions) {If ("android. permission. internet ". equals (premission) {// obtain the process ID of each application in the operating system int uid = info. applicationinfo. UID; // If-1 is returned, this method is not supported. Note that it must be a long RX = trafficstats of more than 2.2. getuidrxbytes (UID); // If-1 is returned, this method is not supported. Note that it must be a long Tx = trafficstats of more than 2.2. getuidtxbytes (UID); If (RX <0 | TX <0) {continue;} else {// toast. maketext (this, info. applicationinfo. loadlabel (PM) + "consumed traffic --" + // formatter. formatfilesize (this, RX + Tx), toast. length_short );}}}}}}