Share via


NetworkStatsManager.QuerySummary Method

Definition

Query network usage statistics summaries.

[Android.Runtime.Register("querySummary", "(ILjava/lang/String;JJ)Landroid/app/usage/NetworkStats;", "GetQuerySummary_ILjava_lang_String_JJHandler", ApiSince=23)]
public virtual Android.App.Usage.NetworkStats? QuerySummary (Android.Net.ConnectivityType networkType, string? subscriberId, long startTime, long endTime);
[<Android.Runtime.Register("querySummary", "(ILjava/lang/String;JJ)Landroid/app/usage/NetworkStats;", "GetQuerySummary_ILjava_lang_String_JJHandler", ApiSince=23)>]
abstract member QuerySummary : Android.Net.ConnectivityType * string * int64 * int64 -> Android.App.Usage.NetworkStats
override this.QuerySummary : Android.Net.ConnectivityType * string * int64 * int64 -> 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.

Returns

Statistics object or null if permissions are insufficient or error happened during statistics collection.

Attributes

Remarks

Java documentation for android.app.usage.NetworkStatsManager.querySummary(int, java.lang.String, long, long).

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