Search code examples
androidacra

android ACRA 4.8 crash report implement own server


I am using ACRA 4.8 for android crash reports. In configuration they said that implement own server. I am unable to understand that. can anybody help me . see documentation below.

https://github.com/ACRA/acra/wiki/Report-Destinations#implementing-your-own-sender Currently my code is like below, please modify it or give an example.

import org.acra.ACRA;
import org.acra.ReportField;
import org.acra.ReportingInteractionMode;
import org.acra.annotation.ReportsCrashes;
import org.acra.collector.CrashReportData;
import org.acra.sender.HttpSender;
import org.acra.sender.ReportSender;
import org.acra.sender.ReportSenderException;


@ReportsCrashes(
        formUri = "https://vooratarun.cloudant.com/acra-gingerbuds/_design/acra-storage/_update/report",
        reportType = HttpSender.Type.JSON,
        httpMethod = HttpSender.Method.POST,
        formUriBasicAuthLogin = "tonsedsollsoonseciablest",
        formUriBasicAuthPassword = "f6c7edefcf5cee94972d63d996be8ab3ee3b9f5d",
    //  formKey = "", // This is required for backward compatibility but not used
        customReportContent = {
                ReportField.APP_VERSION_CODE,
                ReportField.APP_VERSION_NAME,
                ReportField.ANDROID_VERSION,
                ReportField.PACKAGE_NAME,
                ReportField.REPORT_ID,
                ReportField.BUILD,
                ReportField.STACK_TRACE,
                ReportField.DEVICE_ID,
                ReportField.CUSTOM_DATA,
                ReportField.CRASH_CONFIGURATION,
                ReportField.USER_APP_START_DATE,
                ReportField.USER_COMMENT,
                ReportField.USER_IP,
        },
        mode = ReportingInteractionMode.TOAST,
        resToastText = R.string.toast_crash

)

public class AppController extends Application {

    public static final String TAG = AppController.class.getSimpleName();

    private RequestQueue mRequestQueue;
    private ImageLoader mImageLoader;


    private static AppController mInstance;

    public static Context getContext() {
        return mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        ACRA.init(this);
        String deviceId = Settings.Secure.getString(this.getContentResolver(), Settings.Secure.ANDROID_ID);
        ACRA.getErrorReporter().putCustomData("DeviceID", deviceId);
    //  ACRA.getErrorReporter().handleException(null);
        mInstance = this;
        AnalyticsTrackers.initialize(this);
        AnalyticsTrackers.getInstance().get(AnalyticsTrackers.Target.APP);
    }
}

Solution

  • The ACRA wiki link your give is for Implement your own ***sender*** not server.

    Implementing your own sender means implementing org.acra.sender.ReportSender and declaring that in your ACRA config. ACRA will then invoke that class when a crash need to be dispatched.