如何去在Android ENV检测数据的使用 [英] how to go about detecting data usage in the android env

查看:175
本文介绍了如何去在Android ENV检测数据的使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想能够检测到所有使用了Android的环境形式的数据使用量。是否可以密切关注其应用程序调用上的发言权RTP VS WAP等,这样我可以知道在任何时候,当数据被使用的原生程序或第三方应用程序?

I would like to be able to detect all forms of data usage using the android environment. Is it possible to keep tabs on which applications call on say RTP vs WAP etc such that i can know at all times when data is being used by a native program or third party app?

您的帮助和指导,将AP preciated因为我是一个新手在所有这一切,只是开始学习关于An​​droid。

your help and guidance would be appreciated as i am a novice at all of this and just starting to learn about android.

推荐答案

如果你在谈论Android的API来监视应用程序的网络统计数据那么这样的API似乎在升级Froyo增加(2.2)

If you are talking about android API to monitor network statistics by application then such API seems to have been added in Froyo (2.2)

下面是你需要的主类:<一href="http://developer.android.com/reference/android/net/TrafficStats.html">http://developer.android.com/reference/android/net/TrafficStats.html

您可以使用的getuid {接收|的Tx}字节(INT UID)对于给定的过程中的用户ID(你可以从 ActivityManager得到。 getRunningAppProcesses()

You can use getUid{Rx|Tx}Bytes(int uid) for the given process user ID (which you can get from ActivityManager.getRunningAppProcesses())

该API非常简单,简单地给你接收/发送的总字节数,所以你必须做一些更多的工作来跟踪每小时/每天/每月的统计数据。嗯,这一切都取决于你的需求。

The API is very simple, and simply gives you the total bytes received/sent, so you'll have to do some more work to keep track of hourly/daily/monthly stats. Well, that all depends on your needs.

我还没有使用它自己试过,所以我不能给你任何更多的细节,也不知道支持的设备(不是所有的设备都支持该作为API指出的)。

I haven't tried using it myself so I cannot give you any more detail, nor do I know the supported devices (not all devices will support this as the API points out).

祝你好运。

这篇关于如何去在Android ENV检测数据的使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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