Språk

UrlRequest.Builder.SetTrafficStatsTag(Int32) Method

Definition

Sets TrafficStats tag to use when accounting socket traffic caused by this request.

[Android.Runtime.Register("setTrafficStatsTag", "(I)Landroid/net/http/UrlRequest$Builder;", "GetSetTrafficStatsTag_IHandler", ApiSince=34)]
public abstract Android.Net.Http.UrlRequest.Builder SetTrafficStatsTag(int tag);
[<Android.Runtime.Register("setTrafficStatsTag", "(I)Landroid/net/http/UrlRequest$Builder;", "GetSetTrafficStatsTag_IHandler", ApiSince=34)>]
abstract member SetTrafficStatsTag : int -> Android.Net.Http.UrlRequest.Builder

Parameters

tag
Int32

the tag value used when accounting for socket traffic caused by this request. Tags between 0xFFFFFF00 and 0xFFFFFFFF are reserved and used internally by system services like DownloadManager when performing traffic on behalf of an application.

Returns

the builder to facilitate chaining. This value cannot be null.

Attributes

Remarks

Sets TrafficStats tag to use when accounting socket traffic caused by this request. See TrafficStats for more information. If no tag is set (e.g. this method isn't called), then Android accounts for the socket traffic caused by this request as if the tag value were set to 0.

NOTE: Setting a tag disallows sharing of sockets with requests with other tags, which may adversely affect performance by prohibiting connection sharing. In other words use of multiplexed sockets (e.g. HTTP/2 and QUIC) will only be allowed if all requests have the same socket tag.

Android reference for android.net.http.UrlRequest.Builder.setTrafficStatsTag.

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