I want to send the mail of Crash report in background but unable to send because it is using ACTION_SEND
I am using code: formKey = "", mailTo = "[email protected]"
How can i make the url where the reports can be save to my own server, If any dummy url available to store or any open source database can be used. Please recommend.
Thanks
Use this custom class:
public class AcraCustomSender implements ReportSender {
Context activity;
@Override
public void send(Context context, CrashReportData errorContent) throws ReportSenderException {
activity=context;
String crashReport = "";
try {
JSONObject object = errorContent.toJSON();
Log.e("acra", object.toString());
crashReport = object.toString();
}catch (JSONReportBuilder.JSONReportException e) {
e.printStackTrace();
}
//the string crashreport contains your crash log. you can pass it to your own backend.
}
}
Create another class for your application:
public class YourApplication extends Application {
@Override
public void onCreate() {
try {
ACRA.init(this);
AcraCustomSender yourSender = new AcraCustomSender();
ACRA.getErrorReporter().setReportSender(yourSender);
super.onCreate();
}catch (Exception ex) {
ex.printStackTrace();
}
}
}
Now, whenever app crashes you can get it in AcraCustomSender class, and do whatever you want to do(like sending to your own DB)