Compartilhar via


TrafficStats.GetAndSetThreadStatsTag(Int32) Method

Definition

Set active tag to use when accounting Socket traffic originating from the current thread.

[Android.Runtime.Register("getAndSetThreadStatsTag", "(I)I", "", ApiSince=26)]
public static int GetAndSetThreadStatsTag (int tag);
[<Android.Runtime.Register("getAndSetThreadStatsTag", "(I)I", "", ApiSince=26)>]
static member GetAndSetThreadStatsTag : int -> int

Parameters

tag
Int32

Returns

the current tag for the calling thread, which can be used to restore any existing values after a nested operation is finished

Attributes

Remarks

Set active tag to use when accounting Socket traffic originating from the current thread. Only one active tag per thread is supported.

Changes only take effect during subsequent calls to #tagSocket(Socket).

Tags between 0xFFFFFF00 and 0xFFFFFFFF are reserved and used internally by system services like DownloadManager when performing traffic on behalf of an application.

Java documentation for android.net.TrafficStats.getAndSetThreadStatsTag(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