0

I am currently using Crashlytics to report the crashes taking place in a user device. This is working well and i get a detailed stack trace of the error as well as the user information.

I was wondering if it is possible to use the UncaughtExceptionHandler to first catch the exception, send an apology mail or something to the user from after contacting my smtp server.

Then forwarding the exception to Crashlytics to log it in Fabric

Is it possible to use both of these and handover the uncaughtexception to the crashlytics after the mailing part is done?

Clarification:

I was hoping to use crashlytics as it provides a great ui to group exceptions and log the issues... From what i know, crashlytics itself sets a default uncaughtexceptionhandler... so would using my custom handler collide with the one on crashlytics? can two handlers be used at one time...

I want to do both sending the mail and using crashlytics... Is this even possible?

Cristan
  • 12,083
  • 7
  • 65
  • 69
Kushan
  • 5,855
  • 3
  • 31
  • 45
  • 1
    I hope u have already seen [this](http://stackoverflow.com/questions/19897628/need-to-handle-uncaught-exception-and-send-log-file). But it solves one of your problem. – Raghavendra Sep 10 '16 at 09:31
  • yea i've seen that, that's how i know about the Thread.uncaughtexception handler... Crashlytics is a fantastic way to show detailed info so i was thinking having that and the other solution... so do i throw another exception from the uncaughthandler? – Kushan Sep 10 '16 at 09:36
  • This is just a hunch try. In the uncaughtException(Thread thread, Throwable ex) method of the above example can u add the crashlytics line. i.e., "Crashlytics.logException(ex);" and try. – Raghavendra Sep 10 '16 at 09:45
  • 1
    @Raghavendra good idea, but then it will report the crash as non-fatal :( – Kushan Sep 10 '16 at 09:47
  • Possible duplicate of [Crashlytics Android SDK - custom UncaughtExceptionHandler](http://stackoverflow.com/questions/25203616/crashlytics-android-sdk-custom-uncaughtexceptionhandler) – Kushan Sep 10 '16 at 09:51
  • Oh! I'm stuck there, try and if u find some solution update me as well bro:) – Raghavendra Sep 10 '16 at 09:51
  • I found a duplicate for this... ill try it out and see if it works :) Thanks man.. will let you know.. gimme ur email... will let u know – Kushan Sep 10 '16 at 09:51
  • You can update here itself mate:) I'll bookmark this page and will see – Raghavendra Sep 10 '16 at 09:53
  • I'd like to achieve something similar. Any news on how to implement that ? @Raghavendra – tomalf2 Apr 09 '18 at 21:55
  • It can't be done in a traditional way. There can only be one uncaught handler. The workaround is firebase cloud functions for Crashlytics. You can save custom user details while logging and the cloud function can handle emails. Not tested it, should work though – Kushan Apr 09 '18 at 22:01

0 Answers0