6

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!

SolArabehety
  • 8,467
  • 5
  • 38
  • 42

2 Answers2

20

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");

    }

}
joshdholtz
  • 758
  • 6
  • 9
  • 1
    Josh did a great job. Awesome sentry client. – suda Oct 15 '13 at 18:18
  • If anyone steps into this, before going bugsense or crittercism check out this general purpose client for Sentry which worked perfectly for me, worth the time evaluating how dashboards, behaviour and scalability suit your app. – albertpeiro May 20 '14 at 11:09
  • This client has a lot of problems, such as leaking threads. It also performs IO on the main thread. I was tempted to fork it until I ran into more problems than just those. – Evan Leis Mar 10 '16 at 18:23
3

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.

Community
  • 1
  • 1
manavo
  • 1,839
  • 2
  • 14
  • 17
  • Thank you! Do you have any example of how I can send the sentry post after I captured the exception? – SolArabehety Sep 17 '12 at 15:35
  • Maybe using a library that they recommend? List is here: http://sentry.readthedocs.org/en/latest/client/index.html , with this one being the Java one: https://github.com/kencochrane/raven-java – manavo Sep 17 '12 at 15:40