How to get tethering traffic data
Asked Answered
C

0

6

I'm doing an application that store traffic data but i can't get tethering traffics.

    // 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 the Tethering traffic data are always empty. how can I do it?

Capitalism answered 17/2, 2016 at 13:0 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.