Firebase 崩溃报告如何初始化 [英] How does Firebase crash reporting initialize

查看:32
本文介绍了Firebase 崩溃报告如何初始化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我非常好奇应用程序中是如何编写 0 代码的,并且只需要使用库

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'

为了让 firebase 崩溃报告工作.初始化是否总是一次性的,就像应用程序类的 onCreate 总是只调用一次一样?

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?

推荐答案

更新:现在有一篇关于 Firebase 组件如何初始化.

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

Firebase 崩溃报告(除其他 Firebase 组件外)在自动包含在您的应用中的 ContentProvider 中进行初始化.ContentProviders 首先被实例化,然后是你的 Application 子类,然后是任何被调用的组件(Activity、Service、BroadcastReciever).

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).

当您的项目依赖于 Android 库项目(aar 文件)时,其所有清单条目都会合并到您的应用中,因此您只需声明对 firebase-crash 的依赖即可免费获得此 ContentProvider.

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.

我在 2016 年 Google I/O 大会上发表了关于这一切如何运作的演讲.跳转到 16:22 以查看特定于崩溃报告的内容的开头.

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.

这篇关于Firebase 崩溃报告如何初始化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆