How to send crash reports to developer?
Asked Answered
S

2

11

I develop android app but in some cases my app force close

How can I send email to developer contains details if force close happen in any time ?

Selfseeker answered 18/3, 2014 at 7:56 Comment(3)
What exactly is your question? Do you want to send the stacktrace to you, because you are the developer, are you looking for a remote stacktrace?Semple
The ACRA library puts crash reports into a Google spreadsheet. Maybe that's a viable alternative to an e-mail?Corporeal
A.S. yes I want to send trace to my emailSelfseeker
T
17

The ACRA library will fulfill your requirement. You just need to setup the email. The tutorial and setup is defined here.

Download the library with .jar in lib

You just need to define the Application class and write the following code just above application class and override onCreate() method like this

     @ReportsCrashes(formKey = "", // will not be used
                    mailTo = "[email protected]",
                    mode = ReportingInteractionMode.TOAST,
                    resToastText = R.string.crash_toast_text)
    public class MyApplication extends Application {

 @Override
    public void onCreate() {
        ACRA.init(this);
        super.onCreate();
    }

}

Thats it. The email action will get opened whose body contains crash report.

Tallinn answered 18/3, 2014 at 8:6 Comment(1)
Arca's the best! Also, I would add, that you don't need to download the jars. You can also just add: compile 'ch.acra:acra:4.6.2' (find newest) to your gradle build dependencies as well, if using gradle.Kreplach
F
3

You can Use ready APi Such as BugSence and crittercism

After implementation SDK you will recive crush report with crush logs to your email if you whant

For BugSance Download SDK

import com.bugsense.trace.BugSenseHandler;

Make sure you also add the line

 <uses-permission android:name="android.permission.INTERNET" />

to your app's AndroidManifest.xml file. BugSense uses this permission to send the crash reports and performance metrics.

add the BugSenseHandler in your activity before setContentView. Then you are ready to go!

  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    BugSenseHandler.initAndStartSession(Context, APIKEY);
    setContentView(R.layout.main);
    //rest of your code here
  }

The InitAndStartSession method installs the BugSense exception handler and the performance monitor. It then sends all the previously saved crash reports and performance metrics. At the same time, it starts a new session for your activity.

Here's an example on how to use the InitAndStartSession:

BugSenseHandler.initAndStartSession(MyActivity.this, "YOURAPIKEY");

Whenever you want to explicitly start the session, you can use the startSession method at the onStart method of your activity, as follows:

BugSenseHandler.startSession(MyActivity.this);

Whenever you want to close the session, you can use the closeSession method as follows:

BugSenseHandler.closeSession(MyActivity.this);

Close session will close the current session, offering better tracking of the sessions for your users.

If you want to manually flush all the saved data, use the BugSenseHandler.flush(Context) method:

BugSenseHandler.flush(MyActivity.this);

More Documentation Android BugSence Doc

Forging answered 18/3, 2014 at 7:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.