Be kind to your users when apps crash
Mike Rheinheimer 120000KCYA Visits (2029)
IBM Worklight 6.2 SDK has the ability to capture and record a stacktrace and set a marker when an application crashes on iOS and Android. Let's be clear for a moment here; an application crash is when the UI is no longer present in front of the end user, the process dies, and memory is reclaimed by the operating system. A hang or white screen is not a "crash".
What happens to your end user when a crash occurs? Some are simply annoyed and try again, others are impatient and frustrated. Aren't we all, really? Some consider it a pox on your brand, and others make sure that pox grows into a festering wound by complaining publicly in the app stores!
Apps sometimes crash; that's a reality. It could run out of memory, or just run into an unforeseen operating system bug. You can relieve a tiny bit of that end user frustration by indicating that you've detected the crash, and offer them an opportunity to help. Let's dry those tears! Hopefully we'll prevent public complaints too!
Because the crash may be happening early in the code, we should detect and extend the offer as early as possible in native code before another opportunity to crash comes along.
Do this in your main Activity subclass (or perhaps all of your Activity subclasses if you have more than one).
Import required class:
Add the if conditional and contained logic to the onResume method:
You get this:
In objective-c in an iOS app, you can do something similar.
Import the required header file:
Add the if conditional and contained logic at the top of the didF
Add the following function to the controller class:
You get this:
You probably want to see this thing actually work, right? Easy! Just add an else clause to the if conditional to force a crash.
Now on app startup, you will alternate between the forced crash and the friendly dialog box.
Now your users won't be looking at your app through a face full of tears! They feel a little better knowing they've helped and you know about the crash.