Share via


NetworkStatsManager.QueryDetailsForUid Method

Definition

Query network usage statistics details for a given uid.

[Android.Runtime.Register("queryDetailsForUid", "(ILjava/lang/String;JJI)Landroid/app/usage/NetworkStats;", "GetQueryDetailsForUid_ILjava_lang_String_JJIHandler", ApiSince=23)]
public virtual Android.App.Usage.NetworkStats QueryDetailsForUid (Android.Net.ConnectivityType networkType, string? subscriberId, long startTime, long endTime, int uid);
[<Android.Runtime.Register("queryDetailsForUid", "(ILjava/lang/String;JJI)Landroid/app/usage/NetworkStats;", "GetQueryDetailsForUid_ILjava_lang_String_JJIHandler", ApiSince=23)>]
abstract member QueryDetailsForUid : Android.Net.ConnectivityType * string * int64 * int64 * int -> Android.App.Usage.NetworkStats
override this.QueryDetailsForUid : Android.Net.ConnectivityType * string * int64 * int64 * int -> Android.App.Usage.NetworkStats

Parameters

networkType
ConnectivityType

As defined in ConnectivityManager, e.g. ConnectivityManager#TYPE_MOBILE, ConnectivityManager#TYPE_WIFI etc.

subscriberId
String

If applicable, the subscriber id of the network interface. <p>Starting with API level 29, the subscriberId is guarded by additional restrictions. Calling apps that do not meet the new requirements to access the subscriberId can provide a null value when querying for the mobile network type to receive usage for all mobile networks. For additional details see TelephonyManager#getSubscriberId(). <p>Starting with API level 31, calling apps can provide a subscriberId with wifi network type to receive usage for wifi networks which is under the given subscription if applicable. Otherwise, pass null when querying all wifi networks.

startTime
Int64

Start of period. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis.

endTime
Int64

End of period. Defined in terms of "Unix time", see java.lang.System#currentTimeMillis.

uid
Int32

UID of app

Returns

Statistics which is described above.

Attributes

Remarks

Query network usage statistics details for a given uid. This may take a long time, and apps should avoid calling this on their main thread.

Java documentation for android.app.usage.NetworkStatsManager.queryDetailsForUid(int, java.lang.String, long, long, 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