2016-02-03 52 views
-1

我正在使用ACRA 4.8的android崩潰報告。在配置中他們表示實現自己的服務器。我無法理解這一點。有誰能夠幫助我 。 請參閱下面的文檔。android ACRA 4.8崩潰報告實現自己的服務器

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

爲什麼downvote?請解釋 。 –

+0

堆棧溢出用於編程問題。你的問題是什麼? – CommonsWare

回答

2

ACRA維基鏈接你給的是Implement your own ***sender***不是服務器。

實現您自己的發件人意味着實現org.acra.sender.ReportSender並在您的ACRA配置中聲明。然後,當需要派遣崩潰時,ACRA將調用該類。

+0

tq先生,是否強制執行發件人? –

+0

不需要。如果您的傳輸需求不是通過HTTP或電子郵件發送報告,則只需實施ReportSender。 – William