networkstatsmanager

How to get Tethering and Mobile Hotspot data usage in Android using NetworkStatusManager or TrafficStat

梦想的初衷 提交于 2021-01-28 09:14:54
问题 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

Getting mobile data usage history using NetworkStatsManager

情到浓时终转凉″ 提交于 2019-12-17 17:42:06
问题 I want to know the data usage history and noticed the "new" android-6 NetworkStatsManager which seems positive (I've used TrafficStats a while but that won't cover anything previous a reboot). From the API documentation: NOTE: This API requires the permission PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings

Getting mobile data usage history using NetworkStatsManager

ぐ巨炮叔叔 提交于 2019-12-17 17:42:03
问题 I want to know the data usage history and noticed the "new" android-6 NetworkStatsManager which seems positive (I've used TrafficStats a while but that won't cover anything previous a reboot). From the API documentation: NOTE: This API requires the permission PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings

Getting mobile data usage history using NetworkStatsManager

五迷三道 提交于 2019-11-28 04:45:49
I want to know the data usage history and noticed the "new" android-6 NetworkStatsManager which seems positive (I've used TrafficStats a while but that won't cover anything previous a reboot). From the API documentation: NOTE: This API requires the permission PACKAGE_USAGE_STATS, which is a system-level permission and will not be granted to third-party apps. However, declaring the permission implies intention to use the API and the user of the device can grant permission through the Settings application. Profile owner apps are automatically granted permission to query data on the profile they