How to get traffic binding data

I am making an application that stores traffic data, but I cannot get traffic binding.

// UIDs for Tethering ? appNames.put(5, "Tethering WiFi"); appNames.put(7, "Tethering USB"); appNames.put(10, "Tethering BT"); appNames.put(11, "Tethering Unknown"); appNames.put(-5, "!Tethering WiFi"); appNames.put(-7, "!Tethering USB"); appNames.put(-10, "!Tethering BT"); appNames.put(-11, "!Tethering Unknown"); for(ApplicationInfo app : cnt.getPackageManager().getInstalledApplications(0)) { appNames.put(app.uid, app.packageName); } for(Integer uid: appNames.keySet()) { apps.put(uid, new TrafficRecord(uid, appNames.get(uid))); } TrafficRecord(int uid, String tag) { tx = TrafficStats.getUidTxBytes(uid); rx = TrafficStats.getUidRxBytes(uid); this.tag = tag; } 

but Tethering traffic data is always empty. How can i do this?

+6
source share

All Articles