I am using following code to get data used per application for a given time interval
long t1 = System.currentTimeMillis()-(60*1000);long t2 = System.currentTimeMillis();NetworkStats networkStats = networkStatsManager.querySummary(ConnectivityManager.TYPE_WIFI, null, t1, t2); long data_tx = 0;long data_rx = 0; NetworkStats.Bucket bucket = new NetworkStats.Bucket(); while (networkStats.hasNextBucket()) { networkStats.getNextBucket(bucket); String callingApp = context.getPackageManager().getNameForUid(bucket.getUid()); data_tx = bucket.getTxBytes(); data_rx = bucket.getRxBytes(); } but the values of bucket.getTxBytes() and bucket.getRxBytes() for any given application for given time interval is too big which can not be true as i have checked it with glasswire data monitoring app. So is this the right way to get data usage per application for any given time interval and also how can we have real time watch on application to monitor their internet activities? -- You received this message because you are subscribed to the Google Groups "Android Developers" group. To unsubscribe from this group and stop receiving emails from it, send an email to android-developers+unsubscr...@googlegroups.com. To post to this group, send email to android-developers@googlegroups.com. Visit this group at https://groups.google.com/group/android-developers. To view this discussion on the web visit https://groups.google.com/d/msgid/android-developers/3fab0caf-773e-4662-872b-7616fbfcaac0%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.