I need to get a data usage on each application installed on a android mobile.
Ex: I installed YouTube application on my mobile i need to get data usage of YouTube app by wifi and mobile data.
Excepted result:
YouTube - Wifi - 500MB.
YouTube - Mobile Data - 100 KB
I try to use TrafficStats API
int mobileTx = TrafficStats.getMobileTxBytes();
int mobileRx = TrafficStats.getMobileRxBytes();
int wifiTx = TrafficStats.getTotalTxBytes() - mobileTx;
int wifiRx = TrafficStats.getTotalRxBytes() - mobileRx;
the above give me the mobile entire data usage but i need to get per each application.