ACRA device filtering for sending reports

163 views Asked by At

I am developing an application where I have implemented ACRA for log reporting, that's implemented and activated by default in my app configuration. However, when I am developing and entering in a typical trial-error phase, my development device sends a lot of dummy error reporting that are of no interest for me (as I have all information of eclipse).

It gets annoying as I need to discard a significant amount of reports in acralyzer.

What I would like to do, is having a way to configure ACRA that, for a specific device ID, it will not send a report. Some kind of device filtering that allows me developing without filling the database with several reports.

I have been navigating through the documentation of advanced use of ACRA and I have not been able to find it. The only options coming to my mind is commenting the call to the constructor of ACRA when developing for later on activate it when doing the app release.

Is there any other option to solve this problem in a more durable way avoiding me to patch temporary files?

2

There are 2 answers

3
Christian On BEST ANSWER

I'm using something like this as my development report sender:

private static class DummyReportsSender implements ReportSender
{
  @Override
  public void send(CrashReportData arg0) throws ReportSenderException
  {
      //Dummy Reporter - nothing send
  }
}

and then at the Application#onCreate():

if (BuildConfig.DEBUG)
{
  ACRA.getErrorReporter().setReportSender(new DummyReportsSender());
}
6
William On

There is no way to do this with ACRA OOTB.

You could override and decorate the DefaultExceptionHandler after calling ACRA and ignore particular Exception instances. But it sounds like overkill to me.

Either use a different Acralyzer instance for dev, or delete/ignore your dev exceptions.

My dev exceptions are always -SNAPSHOT so they are easy to ignore.