代码之家  ›  专栏  ›  技术社区  ›  Voora Tarun

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

  •  -2
  • Voora Tarun  · 技术社区  · 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);
        }
    }
    
    1 回复  |  直到 8 年前
        1
  •  2
  •   William    8 年前

    您提供的ACRA wiki链接用于 Implement your own ***sender*** 而不是服务器。

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