sentry-java icon indicating copy to clipboard operation
sentry-java copied to clipboard

Providing filters without having to manually init

Open adinauer opened this issue 3 years ago • 3 comments

Problem Statement

When a user wants to set filters like beforeSend etc. they have to disable auto init and use manual init instead. There might be more options / callbacks that could be supplied this way and thus make manual init unnecessary for most use cases.

Solution Brainstorm

Maybe we can add an option for specify the name of a class which is then instantiated by the SDK e.g. using reflection.

adinauer avatar Sep 01 '22 11:09 adinauer

Could also just improve docs and mention that auto init has to be replaced with manual init for certain features.

adinauer avatar Sep 14 '22 14:09 adinauer

Are there any downsides to manual init? For instance, could startup crashes be missed due to a perhaps slightly later initialisation?

mikeduminy avatar Oct 21 '22 12:10 mikeduminy

Maybe an option would be to use AndroidManifest metadata to declare which callbacks should be registered for these before* methods? Also add a lint rule that checks if declared callbacks exist and implement the right interface and that might be a pretty solid solution i think. (similar method to androidx-startup lib)

audkar avatar Aug 09 '23 12:08 audkar