
到目前为止,我只在文档中找到了如何启用选择加入报告
By default,Firebase Crashlytics automatically collects crash reports for all your app’s users. To give users more control over the data they send,you can enable opt-in reporting instead.
To do that,you have to disable automatic collection and initialize Crashlytics only for opt-in users.
Turn off automatic collection with a Meta-data tag in your AndroidManifest.xml file:
<Meta-data androID:name="firebase_crashlytics_collection_enabled" androID:value="false" />
Enable collection for selected users by initializing Crashlytics from one of your app’s activitIEs:
Fabric.with(this,new Crashlytics());
但是我希望能够在崩溃发生时捕获崩溃,并且当应用程序再次启动时显示带有信息的对话框,并要求用户同意将其上载到Crashlytics控制台.
解决方法 您可以创建自定义UncaughtExceptionHandler.>在Application类中,您可以照常启动Crashlytics.
>然后将默认异常处理程序设置为自定义处理程序
UncaughtExceptionHandler customHandler = new UserAgreementExceptionHandler(Thread.getDefaultUncaughtExceptionHandler());Thread.setDefaultUncaughtExceptionHandler(customHandler);
在这种情况下,所有未捕获的异常都将传递给您的处理程序.下一个目标是根据您的需求定制它.它看起来像这样:
public class UserAgreementExceptionHandler implements Thread.UncaughtExceptionHandler { @NonNull private Thread.UncaughtExceptionHandler defaultHandler; public UserAgreementExceptionHandler(@NonNull Thread.UncaughtExceptionHandler defaultHandler) { this.defaultHandler = defaultHandler; } @OverrIDe public voID uncaughtException(Thread thread,Throwable ex) { // Show dialog to user,pass callbacks for answers insIDe // If user agreed to send the data,// call the default handler you passed on object creation: // defaultHandler.uncaughtException(thread,ex); // Otherwise,don't pass it further }} 唯一的问题是如何从它开始一个对话框,它取决于你的应用程序架构.您可以在其中注入一些业务逻辑类,等待使用屏幕上的活动上下文显示对话框.
总结以上是内存溢出为你收集整理的android – 显示对话框,要求用户在Firebase Crashlytics发生崩溃后报告崩溃全部内容,希望文章能够帮你解决android – 显示对话框,要求用户在Firebase Crashlytics发生崩溃后报告崩溃所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
微信扫一扫
支付宝扫一扫
评论列表(0条)