How to Disable Crashlytics/Fabric at Runtime when User Changes Preferences

丶灬走出姿态 提交于 2019-12-05 06:18:23

Fabric on initialization creates a singleton instance and returns same instance whenever you call Fabric.with(...). So, your code inside onPreferenceChangehas no effect on Fabric class.

The only solution to this problem can be if library itself provide methods for enabling or disabling crashlytics. So, up-till now (crashlytics:2.5.2) there is no solution to enable/disable crashlytics at run-time. You have to do it at startup like this:

Fabric.with(this, new Crashlytics.Builder()
    .core(new CrashlyticsCore.Builder()
    .disabled(true).build()).build());
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!