Description
Discussed in #1751
Originally posted by PGliw October 4, 2021
SentryAndroid does call installDefaultIntegrations
in init
Method.
There are some integrations included that are not "the best" choice for my use case.
(SendCachedEventFireAndForgetIntegration
and EnvelopeFileObserverIntegration
I suppose).
The workflow I do want to achieve is following (assuming #1739 is closed by the time):
- First, init SentryAndroid framework, so breadcrumbs are collected
- Do not send any events automatically!
- Check if there was a crash during last app run
- If there was, ask the user what to do with the crash event
- If the user wants to send the cached event, send it. Otherwise just delete the event from the cache.
Sadly, because of coupling SentryAndroid.init
with SendCachedEventFireAndForgetIntegration
, the crash reports are being sent once the app was started after crash. So it's impossible to achieve step 2. having done step 1., isn't it?
Could the initialisation of the framework (that is initialisation of collecting breadcrumbs etc.) be decoupled from sending the cached events? And could sending the events be made "on-demand"?
I assume it's impossible because of coupling SendCachedEventFireAndForgetIntegration
integration's register
method to submitting sending tasks, isn't it? And there is no clean way to enable/disable it on demand.
It might be way of doing it by implementing custom TransportGate
, but how to invoke SendCachedEventFireAndForgetIntegration
later, once we need to send the event? (see point 5.)
Also sending the crash event should not be done after the crash, by on-demand on the next start of the app (UncaughtExceptionHandlerIntegration
seems to do the opposite by default?)