Search in sources :

Example 1 with SyncAccountJobCreator

use of de.geeksfactory.opacclient.reminder.SyncAccountJobCreator 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)

Aggregations

NameNotFoundException (android.content.pm.PackageManager.NameNotFoundException)1 SyncAccountJobCreator (de.geeksfactory.opacclient.reminder.SyncAccountJobCreator)1 PreferenceDataSource (de.geeksfactory.opacclient.storage.PreferenceDataSource)1 ACRAConfiguration (org.acra.config.ACRAConfiguration)1 ACRAConfigurationException (org.acra.config.ACRAConfigurationException)1 ConfigurationBuilder (org.acra.config.ConfigurationBuilder)1 DateTime (org.joda.time.DateTime)1