问题
I have an Android application which displaying data usage per app by NetworkStatusManager, but I can't get data usage for Tethering and Mobile Hotspot. How should I do this?
回答1:
You need to query by UID and pass in the tethering UID: android.app.usage.NetworkStats.Bucket.UID_TETHERING
like so:
networkStatsManager.queryDetailsForUid(ConnectivityManager.TYPE_MOBILE,
subscriberId, startDate, endDate,
android.app.usage.NetworkStats.Bucket.UID_TETHERING);
来源:https://stackoverflow.com/questions/48005563/how-to-get-tethering-and-mobile-hotspot-data-usage-in-android-using-networkstatu