Udostępnij za pośrednictwem


DevicePolicyManager.RetrieveNetworkLogs(ComponentName, Int64) Method

Definition

Called by device owner, profile owner of a managed profile or delegated app with #DELEGATION_NETWORK_LOGGING to retrieve the most recent batch of network logging events.

[Android.Runtime.Register("retrieveNetworkLogs", "(Landroid/content/ComponentName;J)Ljava/util/List;", "GetRetrieveNetworkLogs_Landroid_content_ComponentName_JHandler", ApiSince=26)]
public virtual System.Collections.Generic.IList<Android.App.Admin.NetworkEvent>? RetrieveNetworkLogs (Android.Content.ComponentName? admin, long batchToken);
[<Android.Runtime.Register("retrieveNetworkLogs", "(Landroid/content/ComponentName;J)Ljava/util/List;", "GetRetrieveNetworkLogs_Landroid_content_ComponentName_JHandler", ApiSince=26)>]
abstract member RetrieveNetworkLogs : Android.Content.ComponentName * int64 -> System.Collections.Generic.IList<Android.App.Admin.NetworkEvent>
override this.RetrieveNetworkLogs : Android.Content.ComponentName * int64 -> System.Collections.Generic.IList<Android.App.Admin.NetworkEvent>

Parameters

admin
ComponentName

Which DeviceAdminReceiver this request is associated with, or null if called by a delegated app.

batchToken
Int64

A token of the batch to retrieve

Returns

A new batch of network logs which is a list of NetworkEvent. Returns null if the batch represented by batchToken is no longer available or if logging is disabled.

Attributes

Remarks

Called by device owner, profile owner of a managed profile or delegated app with #DELEGATION_NETWORK_LOGGING to retrieve the most recent batch of network logging events.

When network logging is enabled by a profile owner, the network logs will only include work profile network activity, not activity on the personal profile.

A device owner or profile owner has to provide a batchToken provided as part of DeviceAdminReceiver#onNetworkLogsAvailable callback. If the token doesn't match the token of the most recent available batch of logs, null will be returned.

NetworkEvent can be one of DnsEvent or ConnectEvent.

The list of network events is sorted chronologically, and contains at most 1200 events.

Access to the logs is rate limited and this method will only return a new batch of logs after the device device owner has been notified via DeviceAdminReceiver#onNetworkLogsAvailable.

If the caller is not a profile owner and a secondary user or profile is created, calling this method will throw a SecurityException until all users become affiliated again. It will also no longer be possible to retrieve the network logs batch with the most recent batchToken provided by DeviceAdminReceiver#onNetworkLogsAvailable. See DevicePolicyManager#setAffiliationIds.

Java documentation for android.app.admin.DevicePolicyManager.retrieveNetworkLogs(android.content.ComponentName, 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