Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does Firebase crash reporting initialize

I'm extremely curious how there is 0 code written within the application and all that is required is to use the library

compile 'com.google.firebase:firebase-crash:9.0.1'

in order to get firebase crash reporting working. Is the initialization always a one time thing like how the application class' onCreate is always called just once?

What do I do if i want to enable crash reporting only after a certain event?

like image 757
gaara87 Avatar asked Jun 10 '16 00:06

gaara87


1 Answers

Update: There is now a comprehensive blog post about how Firebase components initialize.

Firebase Crash Reporting (in addition to other Firebase components) initialize in a ContentProvider that's included into your app automatically. ContentProviders are instantiated first, then your Application subclass, then whatever component was invoked (Activity, Service, BroadcastReciever).

When your project depends on an Android Library project (aar file), all of its manifest entries are merged into your app, so you get this ContentProvider for free simply by declaring declaring the dependency on firebase-crash.

I gave a talk at Google I/O 2016 about how this all works. Jump to 16:22 for the beginning of the content specific to crash reporting.

Unfortunately there is currently no way to programmatically enable or disable crash reporting, but that is coming soon.

like image 126
Doug Stevenson Avatar answered Nov 16 '22 02:11

Doug Stevenson