Search in sources :

Example 1 with CoreConfigurationBuilder

use of org.acra.config.CoreConfigurationBuilder in project acra by ACRA.

the class ACRATest method failing.

@Test(expected = AssertionError.class)
public void failing() {
    Application application = ApplicationProvider.getApplicationContext();
    CoreConfigurationBuilder builder = new CoreConfigurationBuilder().withPluginLoader(new SimplePluginLoader(FailingTestAdministrator.class));
    ACRA.init(application, builder);
    ACRA.getErrorReporter().handleException(new RuntimeException());
}
Also used : CoreConfigurationBuilder(org.acra.config.CoreConfigurationBuilder) SimplePluginLoader(org.acra.plugins.SimplePluginLoader) Application(android.app.Application) Test(org.junit.Test)

Example 2 with CoreConfigurationBuilder

use of org.acra.config.CoreConfigurationBuilder in project acra by ACRA.

the class DefaultAttachmentProviderTest method getAttachments.

@Test
public void getAttachments() throws Exception {
    Uri uri = Uri.parse("content://not-a-valid-content-uri");
    List<Uri> result = new DefaultAttachmentProvider().getAttachments(ApplicationProvider.getApplicationContext(), new CoreConfigurationBuilder().withAttachmentUris(uri.toString()).build());
    assertThat(result, hasSize(1));
    assertEquals(uri, result.get(0));
}
Also used : CoreConfigurationBuilder(org.acra.config.CoreConfigurationBuilder) Uri(android.net.Uri) Test(org.junit.Test)

Example 3 with CoreConfigurationBuilder

use of org.acra.config.CoreConfigurationBuilder in project acra by ACRA.

the class MyApplication method attachBaseContext.

@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
    builder.withBuildConfigClass(BuildConfig.class).withReportFormat(StringFormat.JSON);
    builder.getPluginConfigurationBuilder(HttpSenderConfigurationBuilder.class).withUri("https://yourserver.com/report").withEnabled(true);
    ACRA.init(this, builder);
}
Also used : CoreConfigurationBuilder(org.acra.config.CoreConfigurationBuilder)

Example 4 with CoreConfigurationBuilder

use of org.acra.config.CoreConfigurationBuilder in project J2ME-Loader by nikita36078.

the class EmulatorApplication method attachBaseContext.

@SuppressWarnings("ConstantConditions")
@Override
protected void attachBaseContext(Context base) {
    super.attachBaseContext(base);
    if (BuildConfig.DEBUG) {
        MultiDex.install(this);
    }
    ContextHolder.setApplication(this);
    if (isSignatureValid() && !BuildConfig.FLAVOR.equals("dev")) {
        CoreConfigurationBuilder builder = new CoreConfigurationBuilder(this);
        builder.withBuildConfigClass(BuildConfig.class).withParallel(false).withSendReportsInDevMode(false).withEnabled(true);
        builder.getPluginConfigurationBuilder(DialogConfigurationBuilder.class).withResTitle(R.string.crash_dialog_title).withResText(R.string.crash_dialog_message).withResPositiveButtonText(R.string.report_crash).withResTheme(R.style.Theme_AppCompat_Dialog).withEnabled(true);
        ACRA.init(this, builder);
    }
    SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
    sp.registerOnSharedPreferenceChangeListener(themeListener);
    setNightMode(sp.getString(Constants.PREF_THEME, "light"));
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Also used : CoreConfigurationBuilder(org.acra.config.CoreConfigurationBuilder) DialogConfigurationBuilder(org.acra.config.DialogConfigurationBuilder) SharedPreferences(android.content.SharedPreferences)

Example 5 with CoreConfigurationBuilder

use of org.acra.config.CoreConfigurationBuilder in project acra by ACRA.

the class ACRATest method init.

@Test
public void init() {
    Application application = ApplicationProvider.getApplicationContext();
    CoreConfigurationBuilder builder = new CoreConfigurationBuilder().withPluginLoader(new SimplePluginLoader(StacktraceCollector.class, TestAdministrator.class));
    ACRA.init(application, builder);
    ACRA.getErrorReporter().handleException(new RuntimeException());
}
Also used : CoreConfigurationBuilder(org.acra.config.CoreConfigurationBuilder) SimplePluginLoader(org.acra.plugins.SimplePluginLoader) StacktraceCollector(org.acra.collector.StacktraceCollector) Application(android.app.Application) Test(org.junit.Test)

Aggregations

CoreConfigurationBuilder (org.acra.config.CoreConfigurationBuilder)6 Test (org.junit.Test)3 Application (android.app.Application)2 SimplePluginLoader (org.acra.plugins.SimplePluginLoader)2 SharedPreferences (android.content.SharedPreferences)1 Uri (android.net.Uri)1 StacktraceCollector (org.acra.collector.StacktraceCollector)1 ACRAConfigurationException (org.acra.config.ACRAConfigurationException)1 CoreConfiguration (org.acra.config.CoreConfiguration)1 DialogConfigurationBuilder (org.acra.config.DialogConfigurationBuilder)1