Share via


TrafficStats.GetUidRxPackets(Int32) Method

Definition

Return number of packets received by the given UID since device boot.

[Android.Runtime.Register("getUidRxPackets", "(I)J", "")]
public static long GetUidRxPackets (int uid);
[<Android.Runtime.Register("getUidRxPackets", "(I)J", "")>]
static member GetUidRxPackets : int -> int64

Parameters

uid
Int32

Returns

Attributes

Remarks

Return number of packets received by the given UID since device boot. Counts packets across all network interfaces, and always increases monotonically since device boot. Statistics are measured at the network layer, so they include both TCP and UDP usage.

Before android.os.Build.VERSION_CODES#JELLY_BEAN_MR2, this may return #UNSUPPORTED on devices where statistics aren't available.

Starting in android.os.Build.VERSION_CODES#N this will only report traffic statistics for the calling UID. It will return #UNSUPPORTED for all other UIDs for privacy reasons. To access historical network statistics belonging to other UIDs, use NetworkStatsManager.

Java documentation for android.net.TrafficStats.getUidRxPackets(int).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to

See also