Acra: install, expand application - activity?

I am trying to install ACRA crash reporting system in my Android project. Now my project is already expanding the class - the Activity class. How can I implement an Acra project?

As they say in the usual way, you have to create the fe class MyApplication and extend it using the application. Since I am already extending the Activity class, I'm not sure what to do ... They say: if your application already contains a subclass of the application, add ACRA to this class; however, I do not know how I should do this.

Thank!

http://code.google.com/p/acra/wiki/BasicSetup

+5
source share
4 answers

MyApplication, Application, , onCreate(), AndroidManifest.

<application> , android:label android:theme. android:name=".MyApplication", .

, com.example.test, MyApplication . MyApplication , , .

, com.example.test MyApplication com.example.test.application, android:name=".application.MyApplication . , .

+2

. ACRA .

+1

- . ( ):

android:name=".MyApplication"

:

<application
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:name=".MyApplication"
    android:theme="@style/AppTheme" >

- ( Android ), . . .

:

@ReportsCrashes(

    formUri = "https://backend.com",
    customReportContent = { /* */ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME,ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,ReportField.LOGCAT },
    mode = ReportingInteractionMode.TOAST,
    resToastText = R.string.crash_toast_text

)  

public class ACRAHandler extends Application {


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);


        final ACRAConfiguration config = new ConfigurationBuilder(this)

                .build();
        // Initialise ACRA
        ACRA.init(this, config);

    }



}

Firebase, - . , , Firebase.

, ACRA Github: https://github.com/ACRA/acra/wiki/BasicSetup

I answered this because it was so long ago when the answers came and he needed an update

0
source

An application subprocess is necessary to maintain the state of the global application; each application does not require its subclass. If you don’t have an application yet, you can create one.

Example:

/* do ACRA imports */
@ReportsCrashes(formKey = "x-x-x-x-x-x")
public class YourApplication extends Application{

public void onCreate(){
    ACRA.init(this);
    super.onCreate();
}
}

you must also declare in the manifest file as indicated in the tutorial.

-1
source

All Articles