I found how to get data usage from the TrafficStats class, but there's nothing specific about tethering data usage.
How can I get data usage for tethering? Is there any specific UID to target using the TrafficStats mothods?
I found how to get data usage from the TrafficStats class, but there's nothing specific about tethering data usage.
How can I get data usage for tethering? Is there any specific UID to target using the TrafficStats mothods?
Tethering seems a system process. Try to read data of these system processes. Visit this link http://agolovatyuk.blogspot.in/2012/04/android-traffic-statistics-inside.html
https://developer.android.com/reference/android/app/usage/NetworkStatsManager.html>>
use network stats manager API.
You could use queryDetailsForUid()
UID for tethering is (UID_TETHERING) -5 .
use permission
< uses-permission-sdk-23 android:name="android.permission.PACKAGE_USAGE_STATS"/ >
getSubcriber id from telephony manager
which needs < uses-permission android:name="android.permission.READ_PHONE_STATE"/ >
NOTE:works only from api 23