You can use trafficStats class to calculate internet usage for different applications installed in the device if using adb/adb shell isn't a necessary requirement
final PackageManager pm = getPackageManager();
// get a list of installed apps.
List<ApplicationInfo> packages = pm
.getInstalledApplications(PackageManager.GET_META_DATA);
// loop through the list of installed packages and see if the selected
// app is in the list
for (ApplicationInfo packageInfo : packages) {
// get the UID for the selected app
UID = packageInfo.uid;
//internet usage for particular app(sent and received)
long recived = TrafficStats.getUidRxBytes(UID);
long send = TrafficStats.getUidTxBytes(UID);
}
Internet Usage for your application only :
receivedMbs = (double) TrafficStats.getUidRxBytes(android.os.Process
.myUid()) / (1024 * 1024);
sentMbs = (double) TrafficStats.getUidTxBytes(android.os.Process
.myUid()) / (1024 * 1024);
Related links :
TrafficStats Api android and calculation of daily data usage
traffic stats example
Hope it helps .