0

I added the HockeyApp SDK to my Android App. This works as expected, and I also get crash reports of the main activity and the associated classes.

However, I did not figure out how I will get crash reports of the [in my case started & bound] Service. The UpdateManager only accepts Activities and is defined as

UpdateManager.register(Activity, String)

Any idea?

lambruscoAcido
  • 548
  • 4
  • 17

1 Answers1

0

It is sufficient when the Activity calls the appropriate methods of the UpdateManager. The Service must only register the CrashManager by adding this line in e.g. onCreate()

public void onCreate() {
    ...
    CrashManager.register(this, HOCKEY_APP_ID);
}

HOCKEY_APP_ID is the same ID as used in the Activity.

However, the crash of the Service will only be committed to HockeyApp when the Activity restarts.

lambruscoAcido
  • 548
  • 4
  • 17
  • I added a catch of `WindowManager.BadTokenException` because the register call will create a dialog when it finds previous crashes. Otherwise the service will crash the next time again. – Roel May 26 '15 at 10:01
  • 1
    @Roel you have to subclass the CrashManagerListener and say `@Override public boolean shouldAutoUploadCrashes() { return true; }` because then it won't try to show the dialog – EpicPandaForce Apr 21 '16 at 11:50