Android-based traffic statistics and android-based traffic statistics
// --------------------- Traffic statistics -------------------------------- try {PackageManager pm = getPackageManager (); ApplicationInfo ai = pm. getApplicationInfo ("com. orimuse. app ", PackageManager. GET_ACTIVITIES); // com. orimuse. the app is the package name Log of its own application. d ("!! ","!! "+ Ai. uid); long received = TrafficStats. getUidRxBytes (ai. uid); // obtain the number of accepted bytes of a network UID long sent = TrafficStats. getUidTxBytes (ai. uid); // get the number of bytes sent by a network UID Toast. makeText (mContext, "orimuse cumulative receipt of data" + received ED/1024 + "KB", Toast. LENGTH_SHORT ). show (); Toast. makeText (mContext, "orimuse cumulative sending Byte" + sent/1024 + "KB", Toast. LENGTH_SHORT ). show ();} catch (NameNotFoundException e) {e. printStackTrace ();}//-----------------------------------------------------
Q: Is there any interface for android traffic statistics?
The post will be returned, and the landlord has worked hard.
Android has its own traffic statistics. Can I directly call the interface to obtain this?
Obtain the system service. obtain the information from the information service. view the original post about the address book.>
Please accept