安卓:我如何才能找到在每个应用程序的数据使用情况如何? [英] Android: How can I find the Data Usage on a Per-Application Basis?

查看:177
本文介绍了安卓:我如何才能找到在每个应用程序的数据使用情况如何?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图找出在每个应用程序在Android中的数据使用量。像<一个href="http://kschang.hubpages.com/hub/Data-Usage-Monitor-Apps-and-Widgets-for-Android-Phones-and-Devices#slide4646427" rel="nofollow">http://kschang.hubpages.com/hub/Data-Usage-Monitor-Apps-and-Widgets-for-Android-Phones-and-Devices#slide4646427

I am trying to find out the data usage in Android on a per-application basis. Something like http://kschang.hubpages.com/hub/Data-Usage-Monitor-Apps-and-Widgets-for-Android-Phones-and-Devices#slide4646427

我看了一下链接<一个href="http://stackoverflow.com/questions/4812032/how-to-go-about-detecting-data-usage-in-the-android-env">how去了解在Android ENV 检测数据使用

I looked at the link how to go about detecting data usage in the android env

但它没有多大帮助。

任何帮助将是非常美联社preciated。

Any help would be really appreciated.

编辑:

ActivityManager activityManager = (ActivityManager) this.getSystemService(ACTIVITY_SERVICE);

ActivityManager.MemoryInfo mInfo = new ActivityManager.MemoryInfo();

activityManager.getMemoryInfo( mInfo );

List<RunningAppProcessInfo> listOfRunningProcess = activityManager.getRunningAppProcesses();

Log.d(TAG,"XXSize: " + listOfRunningProcess.size());
    for (RunningAppProcessInfo runningAppProcessInfo : listOfRunningProcess) {
        if(runningAppProcessInfo.uid > 1026)
        {
            Log.d(TAG, "ANS " + runningAppProcessInfo.processName + " Id :" + runningAppProcessInfo.pid + " UID: " + runningAppProcessInfo.uid );
        }
    }

我尝试了上面的code为建议的阿科什直拉。然而,所有的UID是数字。不同于 app_79 如你上面提到的。这是好吗?

I tried the above code as suggested by Akos Cz. However all the UID are Numbers. Unlike app_79 as you have mentioned above. Is this alright?

推荐答案

以下链接可以帮助你找出如何编程detemrine每个应用程序的数据使用情况。

The following links should help you figure out how to programatically detemrine the data usage per application.

<一个href="https://github.com/commonsguy/cw-andtuning/tree/master/TrafficMonitor">https://github.com/commonsguy/cw-andtuning/tree/master/TrafficMonitor

<一个href="http://www.techrepublic.com/blog/app-builder/create-a-network-monitor-using-androids-trafficstats-class/774">http://www.techrepublic.com/blog/app-builder/create-a-network-monitor-using-androids-trafficstats-class/774

<一个href="http://agolovatyuk.blogspot.com/2012/04/android-traffic-statistics-inside.html">http://agolovatyuk.blogspot.com/2012/04/android-traffic-statistics-inside.html

您将需要实现你的code使用 TraficStats API和跟踪送的字节数/每UID(应用程序)。接收

You will need to implement your code to use the TraficStats API and track the number of bytes sent/received per UID (application).

这篇关于安卓:我如何才能找到在每个应用程序的数据使用情况如何?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆