- android
- android.accessibilityservice
- android.accounts
- android.content
- android.database.sqlite
- android.graphics
- android.location
- android.media
- android.net
- android.os
- android.text
- android.view
- android.view.inputmethod
- android.widget
- AbsListView
- AbsoluteLayout
- AbsSeekBar
- AbsSpinner
- AdapterView
- AnalogClock
- BaseAdapter
- BaseExpandableListAdapter
- Button
- CheckBox
- CheckedTextView
- Checkable
- Chronometer
- CompoundButton
- CursorAdapter
- CursorTreeAdapter
- DatePicker
- DialerFilter
- DigitalClock
- EditText
- Filter
- Filter.FilterListener
- Filter.FilterResults
- ExpandableListAdapter
- Filterable
- Gallery
- Gallery.LayoutParams
- GridView
- GridLayout
- RadioGroup
- ImageView
- HorizontalScrollView
- ImageButton
- ImageSwitcher
- FilterQueryProvider
- ListAdapter
- ListView
- MediaController
- QuickContactBadge
- RadioButton
- RatingBar
- RelativeLayout
- RemoteViews
- ResourceCursorAdapter
- ResourceCursorTreeAdapter
- Scroller
- ScrollView
- SearchView
- SeekBar
- SeekBar.OnSeekBarChangeListener
- SimpleAdapter
- SimpleCursorAdapter
- SimpleCursorTreeAdapter
- SimpleExpandableListAdapter
- SlidingDrawer
- Spinner
- SpinnerAdapter
- WrapperListAdapter
- TabHost
- TabHost.TabSpec
- TextView
- TimePicker
- Toast
- TableLayout
- TableRow
- TableRow.LayoutParams
- TabWidget
- TextSwitcher
- ToggleButton
- TwoLineListItem
- VideoView
- ViewAnimator
- ViewFlipper
- ViewSwitcher
- ZoomButtonsController
- ZoomButton
- ZoomControls
- dalvik.system
TrafficStats
TrafficStats
版本:Android 2.3 r1
结构
继承关系
public class TrafficStats extends Object
java.lang.Object
android.net.TrafficStats
类概述
提供网络流量统计的类。这些统计包括通过所有网络接口、mobile 接口和 UID 网络接口的字节发送和接收,网络数据包的发送和接收。
这些统计可能不适用于所有平台。如果本设备不支持统计, UNSUPPORTED 将被返回。
常量
public static final int UNSUPPORTED
返回值表示该设备不支持统计。
常量值: -1 (0xffffffff)
公共方法
public static long getMobileRxBytes ()
获取通过 Mobile 接口接收到的字节总数(Android123:这里不包含 WiFi)
返回值
字节总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getMobileRxPackets ()
获取通过 Mobile 接口接收到的数据包总数
返回值
数据包总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getMobileTxBytes ()
获取通过 Mobile 接口发送的字节总数
返回值
字节总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getMobileTxPackets ()
获取通过 Mobile 接口发送的数据包总数
返回值
数据包总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getTotalRxBytes ()
获取通过所有网络接口接收到的字节总数。(Android123:包含 Mobile 和 WiFi 等)
返回值
字节总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getTotalRxPackets ()
获取通过所有网络接口接收到的数据包总数。(Android123:包含 Mobile 和 WiFi 等)
返回值
数据包总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getTotalTxBytes ()
获取通过所有网络接口发送的字节总数。(Android123:包含 Mobile 和 WiFi 等)
返回值
字节总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getTotalTxPackets ()
获取通过所有网络接口发送的数据包总数(Android123:包含 Mobile 和 WiFi 等)
返回值
数据包总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
public static long getUidRxBytes (int uid)
获取通过 UID 网络接口收到的字节数。统计包含所有网络接口。
参数
uid 待检查的进程的 uid
返回值
字节数
参见
public static long getUidTxBytes (int uid)
获取通过 UID 网络接口发送的字节数。统计包含所有网络接口。
参数
uid 待检查的进程的 uid
返回值
字节总数。如果本设备不支持统计, 将返回
UNSUPPORTED 。
参见
补充
文章链接
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论