Android
ACRA
Sök…
Syntax
- android: name = "ACRAHandler"
- ACRA.init (detta, config);
- public class ACRAHandler utvidgar ansökan {
parametrar
Parameter | Beskrivning |
---|---|
@ReportCrashes | Definierar ACRA-inställningar som var det ska rapporteras, anpassat innehåll osv |
formUri | sökvägen till filen som rapporterar kraschen |
Anmärkningar
- ACRA stöder inte längre Google-formulär, så du behöver en backend: https://github.com/ACRA/acra/wiki/Backends
ACRAHandler
Exempel Applikationsförlängningsklass för hantering av rapporteringen:
@ReportsCrashes(
formUri = "https://backend-of-your-choice.com/",//Non-password protected.
customReportContent = { /* */ReportField.APP_VERSION_NAME, ReportField.PACKAGE_NAME,ReportField.ANDROID_VERSION, ReportField.PHONE_MODEL,ReportField.LOGCAT },
mode = ReportingInteractionMode.TOAST,
resToastText = R.string.crash
)
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);
}
}
Exempel manifest
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
<!-- etc -->
>
<!-- Internet is required. READ_LOGS are to ensure that the Logcat is transmitted-->
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.READ_LOGS"/>
<application
android:allowBackup="true"
android:name=".ACRAHandler"<!-- Activates ACRA on startup -->
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<!-- Activities -->
</application>
</manifest>
Installation
Maven
<dependency>
<groupId>ch.acra</groupId>
<artifactId>acra</artifactId>
<version>4.9.2</version>
<type>aar</type>
</dependency>
Gradle
compile 'ch.acra:acra:4.9.2'
Modified text is an extract of the original Stack Overflow Documentation
Licensierat under CC BY-SA 3.0
Inte anslutet till Stack Overflow