Measure data roaming traffic on Android?
来源:互联网 发布:淘宝搜索什么能看片 编辑:程序博客网 时间:2024/04/27 08:20
Question:
Just back from a very nice vacation in Iceland, and await the data roaming bill from my phone company. I hope for the best having limited my traffic as much as possible, but I want to know in advance. I used the very nice appNetCounter but it didn't measure roaming data traffic at all.
So I want to build my own app measuring just roaming data traffic. I have a few booleans to start with (NetworkInfo.IsRoaming() & TelephonyManager.isNetworkRoaming() ), but I'm not sure how to measure the traffic iftrue
.
So the question is: How do I measure data traffic while roaming? (Something like API level 8TrafficStats functionality is what I'm after, but for API level 3). The used SmartPhone is Samsung Galaxy i7500 (Android 1.6)
Answer:
Method 1. Parse "/proc/net/dev".
In my phone it looks like:
Inter-| Receive | Transmit face |bytes packets errs drop fifo frame compressed multicast|bytes packets errs drop fifo colls carrier compressed lo: 712 8 0 0 0 0 0 0 712 8 0 0 0 0 0 0dummy0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0rmnet0: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0rmnet1: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0rmnet2: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 wlan0: 146112 423 32 0 0 0 0 0 42460 409 0 0 0 0 0 0
In my phone the "rmnet0" row holds is the one that holds the stats for mobile line internet. I hope its format does not vary among kernel versions.
Method 2: Parse "/sys/class/net".
I guess this is the recommended method.As shown here: http://www.jaqpot.net/svn/android/netcounter/trunk/src/net/jaqpot/netcounter/service/SysClassNet.java
- Measure data roaming traffic on Android?
- Android 如何默认勾选DATA ROAMING(数据漫游)
- Data roaming notification
- Roaming
- roaming
- android measure
- Android measure
- android measure
- android measure
- 如何默认勾选DATA ROAMING
- 增加National data roaming 菜单定制
- Android Wi-Fi Disable Roaming in wpa_supplicant
- Android Wi-Fi 无缝漫游 Seamless Roaming
- Android Wi-Fi 无缝漫游 Seamless Roaming
- Record network traffic on Android or IOS with Charlies' Proxy or WireShark
- ip traffic export: how to mirror traffic on a router
- android View.measure
- Android之measure流程
- 正则表达式 2
- JNDI的作用是什么
- JAVA基础之理解JNI原理
- HDU2553 N皇后问题(回溯法)
- html 强制换行
- Measure data roaming traffic on Android?
- 利用SPring AOP配置切面的一个例子
- Android笔记(3)——系统时间的获取与音量控制
- hdu 3666 THE MATRIX PROBLEM //2010哈尔滨现场赛
- DataGridView的一般用法(1)
- Windows 电脑命令一览
- MSSQL设计主键类型
- Using the Android Application class to persist data
- 在Oracle中使用rank()over()排名的问题 .