Search in sources :

Example 1 with ConfigurationBuilder

use of org.acra.config.ConfigurationBuilder in project NewPipe by TeamNewPipe.

the class App method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // init crashreport
    try {
        final ACRAConfiguration acraConfig = new ConfigurationBuilder(this).setReportSenderFactoryClasses(reportSenderFactoryClasses).build();
        ACRA.init(this, acraConfig);
    } catch (ACRAConfigurationException ace) {
        ace.printStackTrace();
        ErrorActivity.reportError(this, ace, null, null, ErrorActivity.ErrorInfo.make(ErrorActivity.SEARCHED, "none", "Could not initialize ACRA crash report", R.string.app_ui_crash));
    }
    //init NewPipe
    NewPipe.init(Downloader.getInstance());
    // Initialize image loader
    ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(this).build();
    ImageLoader.getInstance().init(config);
    /*
        SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
        if(prefs.getBoolean(getString(R.string.use_tor_key), false)) {
            OrbotHelper.requestStartTor(this);
            configureTor(true);
        } else {
            configureTor(false);
        }*/
    configureTor(false);
    // DO NOT REMOVE THIS FUNCTION!!!
    // Otherwise downloadPathPreference has invalid value.
    SettingsActivity.initSettings(this);
}
Also used : ConfigurationBuilder(org.acra.config.ConfigurationBuilder) ACRAConfiguration(org.acra.config.ACRAConfiguration) ACRAConfigurationException(org.acra.config.ACRAConfigurationException) ImageLoaderConfiguration(com.nostra13.universalimageloader.core.ImageLoaderConfiguration)

Example 2 with ConfigurationBuilder

use of org.acra.config.ConfigurationBuilder in project opacclient by opacapp.

the class OpacClient method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    sp = PreferenceManager.getDefaultSharedPreferences(this);
    if (!BuildConfig.DEBUG) {
        try {
            final ACRAConfiguration config = new ConfigurationBuilder(this).setResToastText(R.string.crash_toast_text).setResDialogText(R.string.crash_dialog_text).setResToastText(R.string.crash_toast_text).setResNotifTickerText(R.string.crash_notif_ticker_text).setResNotifTitle(R.string.crash_notif_title).setResNotifText(R.string.crash_notif_text).setResNotifIcon(android.R.drawable.stat_notify_error).setResDialogText(R.string.crash_dialog_text).build();
            ACRA.init(this, config);
            if (getLibrary() != null) {
                ACRA.getErrorReporter().putCustomData("library", getLibrary().getIdent());
            }
            DateTime lastUpdate = new PreferenceDataSource(getApplicationContext()).getLastLibraryConfigUpdate();
            ACRA.getErrorReporter().putCustomData("data_version", lastUpdate != null ? lastUpdate.toString() : "null");
        } catch (ACRAConfigurationException e) {
            e.printStackTrace();
        }
    }
    DebugTools.init(this);
    OpacClient.context = getApplicationContext();
    try {
        OpacClient.versionName = getPackageManager().getPackageInfo(getPackageName(), 0).versionName;
    } catch (NameNotFoundException e) {
        e.printStackTrace();
    }
    // Schedule alarms
    JobManager.create(this).addJobCreator(new SyncAccountJobCreator());
    SyncAccountJob.scheduleJob(this);
}
Also used : ConfigurationBuilder(org.acra.config.ConfigurationBuilder) NameNotFoundException(android.content.pm.PackageManager.NameNotFoundException) PreferenceDataSource(de.geeksfactory.opacclient.storage.PreferenceDataSource) ACRAConfiguration(org.acra.config.ACRAConfiguration) ACRAConfigurationException(org.acra.config.ACRAConfigurationException) DateTime(org.joda.time.DateTime) SyncAccountJobCreator(de.geeksfactory.opacclient.reminder.SyncAccountJobCreator)

Example 3 with ConfigurationBuilder

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

the class ACRA method init.

/**
     * <p>
     * Initialize ACRA for a given Application.
     *
     * The call to this method should be placed as soon as possible in the {@link Application#attachBaseContext(Context)} method.
     *
     * Uses the configuration as configured with the @ReportCrashes annotation.
     * Sends any unsent reports.
     * </p>
     *
     * @param app   Your Application class.
     * @throws IllegalStateException if it is called more than once.
     */
public static void init(@NonNull Application app) {
    final ReportsCrashes reportsCrashes = app.getClass().getAnnotation(ReportsCrashes.class);
    if (reportsCrashes == null) {
        log.e(LOG_TAG, "ACRA#init(Application) called but no ReportsCrashes annotation on Application " + app.getPackageName());
        return;
    }
    init(app, new ConfigurationBuilder(app));
}
Also used : ConfigurationBuilder(org.acra.config.ConfigurationBuilder) ReportsCrashes(org.acra.annotation.ReportsCrashes)

Example 4 with ConfigurationBuilder

use of org.acra.config.ConfigurationBuilder in project NewPipe by TeamNewPipe.

the class App method initACRA.

private void initACRA() {
    try {
        final ACRAConfiguration acraConfig = new ConfigurationBuilder(this).setReportSenderFactoryClasses(reportSenderFactoryClasses).setBuildConfigClass(BuildConfig.class).build();
        ACRA.init(this, acraConfig);
    } catch (ACRAConfigurationException ace) {
        ace.printStackTrace();
        ErrorActivity.reportError(this, ace, null, null, ErrorActivity.ErrorInfo.make(UserAction.SOMETHING_ELSE, "none", "Could not initialize ACRA crash report", R.string.app_ui_crash));
    }
}
Also used : ConfigurationBuilder(org.acra.config.ConfigurationBuilder) ACRAConfiguration(org.acra.config.ACRAConfiguration) ACRAConfigurationException(org.acra.config.ACRAConfigurationException)

Aggregations

ConfigurationBuilder (org.acra.config.ConfigurationBuilder)4 ACRAConfiguration (org.acra.config.ACRAConfiguration)3 ACRAConfigurationException (org.acra.config.ACRAConfigurationException)3 NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 ImageLoaderConfiguration (com.nostra13.universalimageloader.core.ImageLoaderConfiguration)1 SyncAccountJobCreator (de.geeksfactory.opacclient.reminder.SyncAccountJobCreator)1 PreferenceDataSource (de.geeksfactory.opacclient.storage.PreferenceDataSource)1 ReportsCrashes (org.acra.annotation.ReportsCrashes)1 DateTime (org.joda.time.DateTime)1