Estoy haciendo una aplicación que almacena datos de tráfico, pero no puedo obtener tráficos de enlace.
// 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; }
pero los datos de tráfico de Tethering siempre están vacíos. ¿Cómo puedo hacerlo?