I feel like crazy pills right now. The specific part of my application works very well for several days, and today it just stopped working, and I canβt understand why. This part of my code is used to display the total data from the moment of loading, which each specific application sent and received. Now the values ββare always displayed as 0.
A few things that may or may not affect this:
1.) My Nexus 4 was recently upgraded to Android 4.3, but I doubt it is a problem because it worked right after my update.
2.) With the Android API 18 update, some methods from the traffic statistics API are now deprecated, but these are methods that I donβt even use, so this should not have any effect. http://developer.android.com/reference/android/net/TrafficStats.html
All help is appreciated.
PackageManager packageManager=this.getPackageManager(); List<ApplicationInfo> appList=packageManager.getInstalledApplications(0); for (ApplicationInfo appInfo : appList) { String appLabel = (String) packageManager.getApplicationLabel(appInfo); int uid = appInfo.uid; Log.d("data", String.valueOf(TrafficStats.getUidRxBytes(uid) + TrafficStats.getUidTxBytes(uid)));
Update [January 23, 2014]: Testing getUidRxBytes () and getUidTxBytes () on my Nexus 4 running Android 4.4.2 shows that the values ββare no longer 0, but report statistics.
android
Richard
source share