Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Monitoring errors with Sentry - Android

Tags:

android

sentry

I need to implement Sentry for my android app, I try to find an example about how I have to implement this, but I can't find it. I saw the Sentry documentation in http://sentry.readthedocs.org/en/latest/developer/client/index.html#server_name

But I have some questions. If my app crash, the exception will be captured? Should I put this code line into my try/catch? var $resultId = myClient->captureException($myException); (in android code)

If somebody has a sample in android I will be grateful.

Thank you!

like image 651
SolArabehety Avatar asked Sep 17 '12 13:09

SolArabehety


2 Answers

I am a little late but I just recently released a Sentry client for Android. It's in its early stages so feel free to pull request any changes that you see.

https://github.com/joshdholtz/Sentry-Android

public class MainActivity extends Activity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // Sentry will look for uncaught exceptions from previous runs and send them        
        Sentry.init(this, "YOUR-SENTRY-DSN");

    }

}
like image 56
joshdholtz Avatar answered Sep 28 '22 07:09

joshdholtz


Maybe try using something like BugSense? http://www.bugsense.com/

If it definitely has to be Sentry, then look at this example: https://stackoverflow.com/a/755151/349012

It shows you how to set your own uncaught exception handler so you can try and upload to Sentry.

like image 33
manavo Avatar answered Sep 28 '22 06:09

manavo