How Firebase Crash Report Initializes

I’m very curious how the application writes 0 code, and all that is required is to use the library

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

to get a firebase crash report. Is initialization always monotonous, for example, how is the application class "onCreate" always called only once?

What should I do if I want to enable the crash report only after a certain event?

+5
source share
2 answers

Update: Now there is a detailed blog post about how Firebase components are initialized .

Firebase Crash Reporting (in addition to other Firebase components) automatically initializes the ContentProvider included in your application. First ContentProviders are created, then your Application subclass, then any component has been called (Activity, Service, BroadcastReciever).

When your project depends on the Android library project (aar file), all of its manifest entries are merged into your application, so you can get this ContentProvider for free by announcing a firebase crash dependency declaration.

I talked about how it all works in Google I / O 2016. Go to 16:22 to start crash reporting specific content.

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

+6
source

So basically, when I use Firebase Crash Reporting, I have to initialize in ContentProvider . Because of this, my application has 2 processes, and if I execute init in Application.onCreate , then it is called twice - once for each process. But other processes do not care about my initialization code, so I do not want to do this twice. Therefore, I can use the ContentProvider or check the current process name. Or maybe there is something else that I am missing?

0
source

All Articles