Disable the Agent to Stop Sending User Data to the Collector

You can disable the agent to stop sending all data to the collector while the agent is initialized and running. For example, you can disable the agent if your app has an option for users to opt-out of monitoring for privacy reasons.

shutdownAgent

The shutdownAgent callstops outgoing data to the collector, and does not persist data on the device.
Objective-C
CODE
[ADEumInstrumentation shutdownAgent];
Swift
CODE
ADEumInstrumentation.shutdownAgent()
Note:
  • The call only stops the traffic out of the agent.
  • Once the agent has been initialized, the call cannot be removed, and a license will have been consumed.
  • If you want to make this state permanent for a device, add code in UserDefaults to save the state and use that flag to conditionally initialize the agent in your code.

restartAgent

To re-enable the agent and reverse shutdownAgent, use restartAgent.
Objective-C
CODE
[ADEumInstrumentation restartAgent];
Swift
CODE
ADEumInstrumentation.restartAgent();
Note:
  • This call will respect the server side calls that can remotely shutdown the agent in a similar way.
  • The call is only in effect while the app is running.
  • The call will be ignored if the agent has been remotely disabled.
  • If the call is removed from memory and the app restarts, or the device is rebooted, the agent will be initialized as normal.