How does Firebase crash reporting initialize

后端 未结 2 1104
忘了有多久
忘了有多久 2021-01-12 05:20

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:fireba         


        
相关标签:
2条回答
  • 2021-01-12 05:26

    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.

    0 讨论(0)
  • 2021-01-12 05:33

    So basically when I'm using Firebase Crash Reporting then I'm forced to do initialization in ContentProvider. My app have 2 processes because of this and if I do init in Application.onCreate then it's called twice - once for each process. But other processes don't care about my init code so I don't want to do it twice. So I can use a ContentProvider or check current process name. Or maybe there is anything else that I'm missing?

    0 讨论(0)
提交回复
热议问题