Question

Hello im trying to add a module to my app so whenever the app crash i can send usefull information to my server/mail to track the error. This info could be the model, Blackberry so version, stacktrace or at least the exception that was unhandled in my app. Obviously i put try/catch where ever i think an error could happen but as human we can make some mistakes :) and is hard to simulate all the issues that a mobile could suffer.

I already implement it on Android wich was more easy since it has a UncaughtExceptionHandler class, also in Android there is a pretty awesome tool to do this if you don't want to do it yourself ACRA. So i want to know if there is a way to do so on Blackberry and if it isn't what is the usual work around for this on this plataform.

Im working on blackberry from Blackberry 5.0 to 7.1. Thanks!

Was it helpful?

Solution

Blackberry has not such mechanism like Thread.setDefaultUncaughtExceptionHandler on Android or NSSetUncaughtExceptionHandler on iOS.

I recommend to use a proposal described in this post

public class MyApp
{
    public static void main(String[] args)
    {
        try {
            new MyApp().enterEventDispatcher();
        } catch (Exception e) {
            // handle exeption
        }
    }
}

If you use own Thread subclasses or Runnable implementations, you should also catch all Exceptions in run() method

P.S. Also there is no way to get stack-trace as string you only able to print it to stdout

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top