Facing problem while getting Network & Security Logs for profile owner app

48 views Asked by At

The project I am working on is a Profile Owner Application. I want to get the Network logs. I have successfully enabled the NetworkLogging and checked the Network logging enable status by setNetworkLoggingEnabled() and isNetworkLoggingEnabled() methods.

Now I want to get the network logs using the retrieveNetworkLogs() method. which requires the parameter "batchToken : Long".

I have tried several ways to get the batchToken but have failed to get it. Now, I want your kind opinion on how to get the batchToken value and solve this problem by calling the retrieveNetworkLogs() method.

Thank you for your time.

val devicePolicyManager = getSystemService(Activity.DEVICE_POLICY_SERVICE) as DevicePolicyManager?

//ComponentName is null because it is called by a delegated app.

devicePolicyManager?.setNetworkLoggingEnabled(null,true) val isEnable = devicePolicyManager?.isNetworkLoggingEnabled(null) val initialLogs = devicePolicyManager?.retrieveNetworkLogs(null, batchToken)

//need to know where to get this batchToken value

1

There are 1 answers

1
Vasanth On