I use ACRA 5.8.4 and I want to update it to 5.9.6 but @annotations are deprecated and I have to change it to PluginConfigurations, but documentation isn't finished and I don't know how to do it. This is my current Application class:
package com.mycompany.myapp;
import android.app.Application;
import android.content.Context;
import androidx.multidex.MultiDex;
import org.acra.ACRA;
import org.acra.annotation.AcraCore;
import org.acra.annotation.AcraDialog;
import org.acra.annotation.AcraMailSender;
@AcraCore(buildConfigClass = BuildConfig.class)
@AcraMailSender(mailTo = "myemail@mydomain.com",
resSubject = R.string.mailsubject)
@AcraDialog(resTitle = R.string.acratitle,
resText = R.string.acratext,
resPositiveButtonText = R.string.acrasend,
resNegativeButtonText = R.string.acracancel,
resCommentPrompt = R.string.acracomprompt )
public class MyAwsomeApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
// The following line triggers the initialization of ACRA
ACRA.init(this);
}
}
And I want to update it to pluginconfigurations:
public class MyAwsomeApplication extends Application {
@Override
protected void attachBaseContext(Context base) {
super.attachBaseContext(base);
MultiDex.install(this);
// The following line triggers the initialization of ACRA
CoreConfigurationBuilder builder;
builder = new CoreConfigurationBuilder()
.withBuildConfigClass(BuildConfig.class)
.withReportFormat(StringFormat.JSON)
.withPluginConfigurations(
<-- I think, here I should add new clases for dialog and mail sender -->
);
ACRA.init(this, builder);
}
}
You can use
.withPluginConfigurations(
new DialogConfigurationBuilder()
.withCommentPrompt(getString(R.string.crash_dialog_comment_prompt))
.withText(getString(R.string.crash_dialog_text))
.build(),
new MailSenderConfigurationBuilder()
.withMailTo("crash@report.xx")
.withReportAsFile(true)
.withReportFileName("Crash.txt")
.withBody("getString(R.string.mail_body)")
.build()
)
examples for configuration builders can be found on: https://www.acra.ch/docs/Senders
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.