Android: Update to Postmortem Reports via email

With the addition of an Activity stack to my portmortem email reporter, it became apparent that relying on the garbage collector to restore the original exception handler was not an ideal solution. I have added a new method called restoreOriginalHandler() that should be called in your Activity class’s onDestroy() method.

public class MyActivity extends Activity {
    protected PostMortemReportExceptionHandler mDamageReport = new PostMortemReportExceptionHandler(this);

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        mDamageReport.initialize();
    }

    @Override
    protected void onDestroy() {
        mDamageReport.restoreOriginalHandler();
        mDamageReport = null;
        super.onDestroy();
    }
}

Original post, updated.

Updated code link (copied from original post):
Full Source

Android: Update to Postmortem Reports via email

It has been a while since my post about Postmortem Reports via email and since then I have upgraded it, commented more on it and fixed a few issues as well. The class now protects against a null exception and uses the application label instead of the activity title in the subject. The class also unregisters itself on finalize as well as protects against sending multiple reports for a single exception if you have several activities active and each has their own handler registered. I am also happy to report that people are willing to send you debug reports. I do not receive more than a handful, but I only need one or two in order to figure out what is going on and fix it. I also can tell how serious it is depending on how frequently I get a report about it. I even get reports from people using a pirated version of my paid apps. Continue reading

Android: Postmortem Reports via email

How can I get postmortem exception information from my deployed app without requiring net access?

One of the major breakthroughs I have had with my Android development has been the addition of a postmortem exception reporter into my apps. I started out my development on the emulator only as I did not have an Android phone of my own yet. I ran into the dilemma of having code that worked fine on the emulator, but crashed on some phones out in the field. Comments were pouring into my app with 1 star ratings and “FC on open”. I searched far and wide for a solution to use with postmortem crash analysis, but each one I researched required net access on the phone in order to report back. I was not going to force the requirement onto my fans because I don’t trust apps that should not need net access but do, so why should I force my fans to trust me? Continue reading