Closed StarLard closed 2 years ago
Idea behind this PR is that my app has a toggle in settings that allows users to turn off analytics. I'm currently handling that by wrapping telemetry in a custom controller and just not forwarding events to the SDK if analytics are turned off, but I know the SDK does some work in the background whether or not I send events. It would be nice to allow adopters to completely shut down the SDK on demand.
This is a very good idea! Can you check wether calling TelemetryManager.send(...)
without an initialized instance causes the app to crash? That would be something to avoid.
It will crash because there is a fatal error when shared
is accessed, but I believe that is expected behavior. If you have called terminate()
you should call initialize
again before trying to interact with the SDK.
Fair enough! Thanks for your contribution :)
This PR adds a terminate method so that users can manually terminate the SDK early if desired.
This is useful for apps which allow their users to enable and disable data collection.