Search in sources :

Example 16 with Crashlytics

use of com.crashlytics.android.Crashlytics in project Shuttle by timusus.

the class ShuttleApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    refWatcher = LeakCanary.install(this);
    sInstance = this;
    if (BuildConfig.DEBUG) {
        Log.w(TAG, "**Debug mode is ON**");
    //            enableStrictMode();
    }
    //Crashlytics
    CrashlyticsCore core = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
    Fabric.with(this, new Crashlytics.Builder().core(core).answers(new Answers()).build(), new Crashlytics());
    //Firebase Analytics
    FirebaseAnalytics.getInstance(this);
    //https://github.com/square/leakcanary/blob/master/leakcanary-android/src/main/java/com/squareup/leakcanary/AndroidExcludedRefs.java
    try {
        Class<?> cls = Class.forName("android.sec.clipboard.ClipboardUIManager");
        Method m = cls.getDeclaredMethod("getInstance", Context.class);
        Object o = m.invoke(null, this);
    } catch (Exception ignored) {
    }
    VideoCastManager.initialize(this, new CastConfiguration.Builder(Config.CHROMECAST_APP_ID).enableLockScreen().enableNotification().build());
    final SharedPreferences mPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    setIsUpgraded(mPrefs.getBoolean("pref_theme_gold", false));
    // files with readAgain flag set to false, so always check KEY_HAS_SET_DEFAULT_VALUES
    if (!mPrefs.getBoolean(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES, false)) {
        PreferenceManager.setDefaultValues(this, R.xml.settings_artwork, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_blacklist, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_display, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_headers, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_headset, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_scrobbling, true);
        PreferenceManager.setDefaultValues(this, R.xml.settings_themes, true);
    }
    // Turn off logging for jaudiotagger.
    jaudioTaggerLogger1.setLevel(Level.OFF);
    jaudioTaggerLogger2.setLevel(Level.OFF);
    TagOptionSingleton.getInstance().setPadNumbers(true);
    SettingsManager.getInstance().incrementLaunchCount();
    startService(new Intent(this, EqualizerService.class));
    Observable.fromCallable(() -> {
        Query query = new Query.Builder().uri(CustomArtworkTable.URI).projection(new String[] { CustomArtworkTable.COLUMN_ID, CustomArtworkTable.COLUMN_KEY, CustomArtworkTable.COLUMN_TYPE, CustomArtworkTable.COLUMN_PATH }).build();
        SqlUtils.createActionableQuery(ShuttleApplication.this, cursor -> userSelectedArtwork.put(cursor.getString(cursor.getColumnIndexOrThrow(CustomArtworkTable.COLUMN_KEY)), new UserSelectedArtwork(cursor.getInt(cursor.getColumnIndexOrThrow(CustomArtworkTable.COLUMN_TYPE)), cursor.getString(cursor.getColumnIndexOrThrow(CustomArtworkTable.COLUMN_PATH)))), query);
        return null;
    }).subscribeOn(Schedulers.io()).subscribe();
    //Clean up the 'most played' playlist. We delay this call to allow the app to finish launching,
    //since it's not time critical.
    new Handler().postDelayed(this::cleanMostPlayedPlaylist, 5000);
    //Clean up the genres database - remove any genres which contain no songs.
    new Handler().postDelayed(this::cleanGenres, 7500);
    //Clean up any old, unused resources.
    new Handler().postDelayed(this::deleteOldResources, 10000);
}
Also used : CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Answers(com.crashlytics.android.answers.Answers) Query(com.simplecity.amp_library.model.Query) SharedPreferences(android.content.SharedPreferences) Handler(android.os.Handler) Intent(android.content.Intent) Method(java.lang.reflect.Method) EqualizerService(com.simplecity.amp_library.services.EqualizerService) Crashlytics(com.crashlytics.android.Crashlytics) UserSelectedArtwork(com.simplecity.amp_library.model.UserSelectedArtwork)

Example 17 with Crashlytics

use of com.crashlytics.android.Crashlytics in project Rutgers-Course-Tracker by tevjef.

the class RutgersCTApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    //refWatcher = LeakCanary.install(this);
    Once.initialise(this);
    objectGraph = ObjectGraph.create(new RutgersCTModule(getApplicationContext()));
    //Initalize crash reporting apis
    Fabric.with(this, new Crashlytics());
    if (BuildConfig.DEBUG) {
        //When debugging logs will go through the Android logger
        Timber.plant(new Timber.DebugTree());
        Stetho.initializeWithDefaults(this);
    } else {
        //Mint.enableDebug();
        //Mint.initAndStartSession(this, "2974ff7f");
        //Gets a unique id for for every installation
        String s = getsID(getApplicationContext());
        //Set unique user id
        //Mint.setUserIdentifier(s);
        Crashlytics.setUserIdentifier(s);
        //Diverts logs through crash reporting APIs
        Timber.plant(new CrashReportingTree());
    }
}
Also used : Timber(timber.log.Timber) Crashlytics(com.crashlytics.android.Crashlytics)

Example 18 with Crashlytics

use of com.crashlytics.android.Crashlytics in project WordPress-Android by wordpress-mobile.

the class WordPress method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    mContext = this;
    long startDate = SystemClock.elapsedRealtime();
    // Init WellSql
    WellSql.init(new WellSqlConfig(getApplicationContext()));
    // Init Dagger
    mAppComponent = DaggerAppComponent.builder().appContextModule(new AppContextModule(getApplicationContext())).build();
    component().inject(this);
    mDispatcher.register(this);
    // Init static fields from dagger injected singletons, for legacy Actions/Utils
    sRequestQueue = mRequestQueue;
    sImageLoader = mImageLoader;
    sOAuthAuthenticator = mOAuthAuthenticator;
    ProfilingUtils.start("App Startup");
    // Enable log recording
    AppLog.enableRecording(true);
    AppLog.i(T.UTILS, "WordPress.onCreate");
    if (!PackageUtils.isDebugBuild()) {
        Fabric.with(this, new Crashlytics());
    }
    // If the migration was not done and if we have something to migrate
    runFluxCMigration();
    versionName = PackageUtils.getVersionName(this);
    initWpDb();
    enableHttpResponseCache(mContext);
    // EventBus setup
    EventBus.TAG = "WordPress-EVENT";
    EventBus.builder().logNoSubscriberMessages(false).sendNoSubscriberEvent(false).throwSubscriberException(true).installDefaultEventBus();
    RestClientUtils.setUserAgent(getUserAgent());
    // PasscodeLock setup
    if (!AppLockManager.getInstance().isAppLockFeatureEnabled()) {
        // Make sure that PasscodeLock isn't already in place.
        // Notifications services can enable it before the app is started.
        AppLockManager.getInstance().enableDefaultAppLockIfAvailable(this);
    }
    if (AppLockManager.getInstance().isAppLockFeatureEnabled()) {
        AppLockManager.getInstance().getAppLock().setExemptActivities(new String[] { "org.wordpress.android.ui.ShareIntentReceiverActivity" });
    }
    HelpshiftHelper.init(this);
    ApplicationLifecycleMonitor applicationLifecycleMonitor = new ApplicationLifecycleMonitor();
    registerComponentCallbacks(applicationLifecycleMonitor);
    registerActivityLifecycleCallbacks(applicationLifecycleMonitor);
    initAnalytics(SystemClock.elapsedRealtime() - startDate);
    // If users uses a custom locale set it on start of application
    WPActivityUtils.applyLocale(getContext());
    // Allows vector drawable from resources (in selectors for instance) on Android < 21 (can cause issues
    // with memory usage and the use of Configuration). More informations:
    // https://developer.android.com/reference/android/support/v7/app/AppCompatDelegate.html#setCompatVectorFromResourcesEnabled(boolean)
    // Note: if removed, this will cause crashes on Android < 21
    AppCompatDelegate.setCompatVectorFromResourcesEnabled(true);
}
Also used : AppContextModule(org.wordpress.android.fluxc.module.AppContextModule) WellSqlConfig(org.wordpress.android.fluxc.persistence.WellSqlConfig) Crashlytics(com.crashlytics.android.Crashlytics)

Example 19 with Crashlytics

use of com.crashlytics.android.Crashlytics in project BottomNavigation by Ashok-Varma.

the class HomeActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_home);
    bottomNavigationBar = (BottomNavigationBar) findViewById(R.id.bottom_navigation_bar);
    fabHome = (FloatingActionButton) findViewById(R.id.fab_home);
    modeFixed = (CheckBox) findViewById(R.id.mode_fixed);
    modeShifting = (CheckBox) findViewById(R.id.mode_shifting);
    bgStatic = (CheckBox) findViewById(R.id.bg_static);
    bgRipple = (CheckBox) findViewById(R.id.bg_ripple);
    showText = (CheckBox) findViewById(R.id.show_text);
    items3 = (CheckBox) findViewById(R.id.items_3);
    items4 = (CheckBox) findViewById(R.id.items_4);
    items5 = (CheckBox) findViewById(R.id.items_5);
    autoHide = (CheckBox) findViewById(R.id.auto_hide);
    toggleHide = (Button) findViewById(R.id.toggle_hide);
    toggleBadge = (Button) findViewById(R.id.toggle_badge);
    message = (TextView) findViewById(R.id.message);
    scrollableText = (TextView) findViewById(R.id.scrollable_text);
    modeFixed.setOnCheckedChangeListener(this);
    modeShifting.setOnCheckedChangeListener(this);
    bgRipple.setOnCheckedChangeListener(this);
    bgStatic.setOnCheckedChangeListener(this);
    showText.setOnCheckedChangeListener(this);
    items3.setOnCheckedChangeListener(this);
    items4.setOnCheckedChangeListener(this);
    items5.setOnCheckedChangeListener(this);
    autoHide.setOnCheckedChangeListener(this);
    toggleHide.setOnClickListener(this);
    toggleBadge.setOnClickListener(this);
    fabHome.setOnClickListener(this);
    bottomNavigationBar.setTabSelectedListener(this);
    refresh();
}
Also used : Crashlytics(com.crashlytics.android.Crashlytics)

Aggregations

Crashlytics (com.crashlytics.android.Crashlytics)19 Intent (android.content.Intent)3 Handler (android.os.Handler)3 Timber (timber.log.Timber)3 Toolbar (android.support.v7.widget.Toolbar)2 View (android.view.View)2 Answers (com.crashlytics.android.answers.Answers)2 CrashlyticsCore (com.crashlytics.android.core.CrashlyticsCore)2 FlowConfig (com.raizlabs.android.dbflow.config.FlowConfig)2 Fabric (io.fabric.sdk.android.Fabric)2 SharedPreferences (android.content.SharedPreferences)1 Bundle (android.os.Bundle)1 FloatingActionButton (android.support.design.widget.FloatingActionButton)1 NavigationView (android.support.design.widget.NavigationView)1 FragmentTransaction (android.support.v4.app.FragmentTransaction)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 RecyclerView (android.support.v7.widget.RecyclerView)1 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)1 RelativeLayout (android.widget.RelativeLayout)1