Dil

UrlRequest.Builder.SetTrafficStatsUid(Int32) Method

Definition

Sets specific UID to use when accounting socket traffic caused by this request.

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

Parameters

uid
Int32

the UID to attribute socket traffic caused by this request.

Returns

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

Attributes

Remarks

Sets specific UID to use when accounting socket traffic caused by this request. See TrafficStats for more information. Designed for use when performing an operation on behalf of another application. Caller must hold android.Manifest.permission#MODIFY_NETWORK_ACCOUNTING permission. By default traffic is attributed to UID of caller.

NOTE: Setting a UID disallows sharing of sockets with requests with other UIDs, 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 UID set.

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

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