android应用流量信息提取
adb -s 设备名称 shell 进入对应的设备
cd proc 进入设备的属性目录
cd uid_stat 进入 user id 状态目录,每个应用程序在安装的时候系统会为每个应用分配一个对应的 uid
ls 列出 uid_stat 目录下所有应用对应的 user id 目录
cd uid 进入对应应用的 uid 目录
ls 查看对应 uid 目录下的 tcp_rcv 和 tcp_snd 目录
cat tcp_rcv 查看该应用接收的数据信息
cat tcp_snd 查看该应用发送的数据信息

import android.app.Activity;
import android.net.TrafficStats;
import android.os.Bundle;
import android.view.Menu;
public class MainActivity extends Activity {
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
/** 获取手机通过 2G/3G 接收的字节流量总数 */
TrafficStats.getMobileRxBytes();
/** 获取手机通过 2G/3G 接收的数据包总数 */
TrafficStats.getMobileRxPackets();
/** 获取手机通过 2G/3G 发出的字节流量总数 */
TrafficStats.getMobileTxBytes();
/** 获取手机通过 2G/3G 发出的数据包总数 */
TrafficStats.getMobileTxPackets();
/** 获取手机通过所有网络方式接收的字节流量总数(包括 wifi) */
TrafficStats.getTotalRxBytes();
/** 获取手机通过所有网络方式接收的数据包总数(包括 wifi) */
TrafficStats.getTotalRxPackets();
/** 获取手机通过所有网络方式发送的字节流量总数(包括 wifi) */
TrafficStats.getTotalTxBytes();
/** 获取手机通过所有网络方式发送的数据包总数(包括 wifi) */
TrafficStats.getTotalTxPackets();
/** 获取手机指定 UID 对应的应程序用通过所有网络方式接收的字节流量总数(包括 wifi) */
TrafficStats.getUidRxBytes(uid);
/** 获取手机指定 UID 对应的应用程序通过所有网络方式发送的字节流量总数(包括 wifi) */
TrafficStats.getUidTxBytes(uid);
}
public boolean onCreateOptionsMenu(Menu menu) {
getMenuInflater().inflate(R.menu.activity_main, menu);
return true;
}
}
android应用流量信息提取的更多相关文章
- Fiddler如何抓取使用了SSL或TLS传输的Android App流量
上篇文章介绍了Burpsuite如何抓取使用了SSL或TLS传输的Android App流量, 那么使用Fiddler的时候其实 也会出现与burpsuite同样的情况,解决方案同样是需要将Fiddl ...
- android app 流量统计
https://blog.csdn.net/yzy9508/article/details/48300265 | android 数据流量统计 - CSDN博客https://blog.csdn.ne ...
- Android之——流量管理程序演示样例
转载请注明出处:http://blog.csdn.net/l1028386804/article/details/47680811 眼下.市面上有非常多管理手机流量的软件,能够让用户实时获取到自己手机 ...
- Android 网络流量监听开源项目-ConnectionClass源码分析
很多App要做到极致的话,对网络状态的监听是很有必要的,比如在网络差的时候加载质量一般的小图,缩略图,在网络好的时候,加载高清大图,脸书的android 客户端就是这么做的, 当然伟大的脸书也把这部分 ...
- Android测试流量的几种方法
1. tcpdump + wireshark 1.1 tcpdump抓包 注意:Android设备使用tcpdump需要root权限 tcpdump是一个在Unix-like系统中通用的网络抓包工具, ...
- Stack Overflow:研究发现访问PHP和 Android的流量更可能来自低收入国家
Stack Overflow 的数据科学家 David Robinson 发现,软件行业的分工让不同发达地区的程序员依赖于不同的编程语言.软件已经是一个全球性的行业,也有高端低端之分,最高端的是数据 ...
- Android应用流量测试
工具 GT(中文产品名称:随身调):是腾讯出品的开源调试工具,本次测试中用其进行手机的流量统计和抓包.请在Android手机上安装GT应用(可以通过官网或应用宝下载). Wireshark:抓包的分析 ...
- Android手机流量分析工具介绍
一.20 Best Android Hacking Apps And Tools Of 2018 首先罗列常见的Android手机hacking的工具 #1The Android Network Ha ...
- [Android Pro] Android7.0系统 关于Android获取流量计数TrafficStats.getUidRxBytes(uid)和TrafficStats.getUidTxBytes(uid)返回-1解决方案
reference : http://blog.csdn.net/zhangyong7112/article/details/54574214 最近一个关于流量的项目在Android7.0系统的手机上 ...
随机推荐
- SPOJ:Bits. Exponents and Gcd(组合数+GCD)
Rastas's has been given a number n. Being weak at mathematics, she has to consider all the numbers f ...
- POJ2443 Set Operation (基础bitset应用,求交集)
You are given N sets, the i-th set (represent by S(i)) have C(i) element (Here "set" isn't ...
- Java内存溢出?
内存溢出? https://www.cnblogs.com/crossoverJie/p/9552119.html 前言 OutOfMemoryError 问题相信很多朋友都遇到过,相对于常见的业务异 ...
- iOS NSInteger/NSUInteger与int/unsigned int、long/unsigned long之间的区别!
在iOS开发中经常使用NSInteger和NSUInteger,而在其他的类似于C++的语言中,我们经常使用的是int.unsigned int.我们知道iOS也可以使用g++编译器,那么它们之间是否 ...
- Java调用Static修饰的本类方法
public class Dy { public static void main(String[] args){ int a=6; int b=5; int result=0; result=Add ...
- The IBM Blockchain Platform: Develop pre-requisites
Installing pre-requisites The IBM Blockchain Platform: Develop pre-requisites can be installed on Ub ...
- E20180430-hm
pants n. <英>(紧身的)短裤; <美> 裤子; 喘气( pant的名词复数 ); leggings n. 绑腿; 裹腿; 绷腿; 袜统; redundant adj. ...
- 862. Shortest Subarray with Sum at Least K
Return the length of the shortest, non-empty, contiguous subarray of A with sum at least K. If there ...
- 当打开一个.h或.cpp文件时, Solution Explorer就自动展开文件所在的目录
当打开一个.h或.cpp文件时, Solution Explorer就自动展开文件所在的目录: 如果不想展开: Tools -> Options -&g ...
- python 之 random 模块、 shutil 模块、shelve模块、 xml模块
6.12 random 模块 print(random.random()) (0,1)----float 大于0且小于1之间的小数 print(random.randint(1,3)) [1,3] 大 ...