Skip to content
F43nd1r edited this page May 19, 2021 · 3 revisions

Documentation has moved! Visit acra.ch for versions 5.8 forward


Example annotation configuration

@AcraCore(buildConfigClass = BuildConfig.class,
          reportFormat = StringFormat.JSON)
@AcraHttpSender(uri = "https://yourdomain.com/acra/report",
                httpMethod = HttpSender.Method.POST,
                basicAuthLogin = "*****",
                basicAuthPassword = "*****")
@AcraScheduler(requiresNetworkType = JobInfo.NETWORK_TYPE_UNMETERED,
               requiresBatteryNotLow = true)
@AcraLimiter
public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        ACRA.init(this);
    }
}

Example builder configuration

Same as above, but without annotations

public class MyApplication extends Application {
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this)
                .setBuildConfigClass(BuildConfig.class)
                .setReportFormat(StringFormat.JSON);
        builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class)
                .setUri("https://yourdomain.com/acra/report")
                .setHttpMethod(HttpSender.Method.POST)
                .setBasicAuthLogin("*****")
                .setBasicAuthPassword("*****")
                .setEnabled(true);
        builder.getPluginConfigurationBuilder(SchedulerConfigurationBuilder.class)
                .setRequiresNetworkType(JobInfo.NETWORK_TYPE_UNMETERED)
                .setRequiresBatteryNotLow(true)
                .setEnabled(true);
        builder.getPluginConfigurationBuilder(LimiterConfigurationBuilder.class)
                .setEnabled(true);
        ACRA.init(this, builder);
    }
}
Clone this wiki locally