title: How to log crash details from CustomActivityOnCrash
body: <p>We are using the <a href="https://github.com/Ereza/CustomActivityOnCrash" rel="nofollow noreferrer">Ereza CustomActivityOnCrash</a> library to handle unexpected issues with our android app. It's activity offers some debug output which we enable in develop and test builds but disable on production builds. In addition we want to log that information about crash details (log entries, stack trace, error details) in background. </p>
  
  <p><code>CustomActivityOnCrash</code> offers to call event listeners which sounds convenient. I wanted to implement the interface in our logging service, however I do not understand how I can access the existing information in the crash activity that way. Which puzzles me, cause isn't that a natural expectation? </p>
  
  <p>Basically I need to access public methods of an android activity object from an event listener method that does not get handed over anything. How can I access that activity in the handler method? And how can I get the intent of the activity leading to the crash which is the argument the crash activity expects in those public methods it offers to access the existing information it offers? The examples given in the libraries documentation and those I could find on the internet are trivial, they only dump example strings, not the actual data collected by the library. </p>
  
  <p>This all sounds counter intuitive to me. Which is why I think I generally miss something here. Maybe someone has a short hint for me to bring me on track again. Thanks!</p>
  
  <p>Here is the basics of the LogService implementation I imagine: </p>
  
  <pre><code>...
  import cat.ereza.customactivityoncrash.CustomActivityOnCrash;
  ...
  public class LogService
          implements CustomActivityOnCrash.EventListener {
      private static LogService instance;
      ...
      public void log(LogLevel level, String message) {
          ....
      }
      public void logCrashDetails(String activityLog, String stackTrace, String errorDetails) {
          String message = String.format(
                  "--- CRASH REPORT ---\n\n-- Activity log:\n%s\n\n- Stack trace:\n%s\n\nError details:\n%s",
                  activityLog,
                  stackTrace,
                  errorDetails);
          log(LogLevel.ERROR, message);
      }
      ....
      // CustomActivityOnCrash EventListener interface
      @Override
      public void onLaunchErrorActivity() {
          log(LogLevel.INFO, "COAC: app crashed");
          logCrashDetails(
                  // CustomActivityOnCrash.getActivityLogFromIntent(...some intent...),
                  // CustomActivityOnCrash.getStackTraceFromIntent(...some intent...),
                  // CustomActivityOnCrash.getAllErrorDetailsFromIntent(...some intent...)
          );
      }
  
      @Override
      public void onRestartAppFromErrorActivity() {
          log(LogLevel.INFO, "COAC: app restarted");
      }
  
      @Override
      public void onCloseAppFromErrorActivity() {
          log(LogLevel.INFO, "COAC: app closed");
      }
  }
  </code></pre>