安卓ACRA 4.8崩溃报告实现自己的服务器



我正在使用ACRA 4.8进行Android崩溃报告。在配置中,他们说实现自己的服务器。我无法理解这一点。谁能帮我.请参阅下面的文档。

https://github.com/ACRA/acra/wiki/Report-Destinations#implementing-your-own-sender目前我的代码如下,请修改或举例说明。

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

您提供的ACRA维基链接是针对Implement your own ***sender***而不是服务器。

实现

您自己的发送器意味着实现org.acra.sender.ReportSender并在您的 ACRA 配置中声明。然后,ACRA 将在需要调度崩溃时调用该类。

相关内容

  • 没有找到相关文章

最新更新