Class Overview
Class that provides network traffic statistics. These statistics include
bytes transmitted and received and network packets transmitted and received,
over all interfaces, over the mobile interface, and on a per-UID basis.
These statistics may not be available on all platforms. If the statistics
are not supported by this device, UNSUPPORTED
will be returned.
Summary
Constants |
int |
UNSUPPORTED |
The return value to indicate that the device does not support the statistic. |
Public Methods |
static
long
|
getMobileRxBytes()
Get the total number of bytes received through the mobile interface.
|
static
long
|
getMobileRxPackets()
Get the total number of packets received through the mobile interface.
|
static
long
|
getMobileTxBytes()
Get the total number of bytes transmitted through the mobile interface.
|
static
long
|
getMobileTxPackets()
Get the total number of packets transmitted through the mobile interface.
|
static
long
|
getTotalRxBytes()
Get the total number of bytes received through all network interfaces.
|
static
long
|
getTotalRxPackets()
Get the total number of packets received through all network interfaces.
|
static
long
|
getTotalTxBytes()
Get the total number of bytes sent through all network interfaces.
|
static
long
|
getTotalTxPackets()
Get the total number of packets sent through all network interfaces.
|
static
long
|
getUidRxBytes(int uid)
Get the number of bytes received through the network for this UID.
|
static
long
|
getUidTxBytes(int uid)
Get the number of bytes sent through the network for this UID.
|
[Expand]
Inherited Methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this Object .
|
boolean
|
equals(Object o)
Compares this instance with the specified object and indicates if they
are equal.
|
void
|
finalize()
Called before the object's memory is reclaimed by the VM.
|
final
Class<?>
|
getClass()
Returns the unique instance of Class that represents this
object's class.
|
int
|
hashCode()
Returns an integer hash code for this object.
|
final
void
|
notify()
Causes a thread which is waiting on this object's monitor (by means of
calling one of the wait() methods) to be woken up.
|
final
void
|
notifyAll()
Causes all threads which are waiting on this object's monitor (by means
of calling one of the wait() methods) to be woken up.
|
String
|
toString()
Returns a string containing a concise, human-readable description of this
object.
|
final
void
|
wait()
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object.
|
final
void
|
wait(long millis, int nanos)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
final
void
|
wait(long millis)
Causes the calling thread to wait until another thread calls the notify() or notifyAll() method of this object or until the
specified timeout expires.
|
|
Constants
public
static
final
int
UNSUPPORTED
The return value to indicate that the device does not support the statistic.
Constant Value:
-1
(0xffffffff)
Public Constructors
Public Methods
public
static
long
getMobileRxBytes
()
Get the total number of bytes received through the mobile interface.
Returns
- number of bytes. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getMobileRxPackets
()
Get the total number of packets received through the mobile interface.
Returns
- number of packets. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getMobileTxBytes
()
Get the total number of bytes transmitted through the mobile interface.
Returns
- number of bytes. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getMobileTxPackets
()
Get the total number of packets transmitted through the mobile interface.
Returns
- number of packets. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getTotalRxBytes
()
Get the total number of bytes received through all network interfaces.
Returns
- number of bytes. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getTotalRxPackets
()
Get the total number of packets received through all network interfaces.
Returns
- number of packets. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getTotalTxBytes
()
Get the total number of bytes sent through all network interfaces.
Returns
- number of bytes. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getTotalTxPackets
()
Get the total number of packets sent through all network interfaces.
Returns
- the number of packets. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.
public
static
long
getUidRxBytes
(int uid)
Get the number of bytes received through the network for this UID.
The statistics are across all interfaces.
.
Parameters
uid
| The UID of the process to examine. |
public
static
long
getUidTxBytes
(int uid)
Get the number of bytes sent through the network for this UID.
The statistics are across all interfaces.
.
Parameters
uid
| The UID of the process to examine. |
Returns
- number of bytes. If the statistics are not supported by this device,
UNSUPPORTED
will be returned.