Search in sources :

Example 46 with Crashlytics

use of com.crashlytics.android.Crashlytics in project TeamCityApp by vase4kin.

the class TeamCityApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // #=============== Fabric ================#//
    if (!BuildConfig.DEBUG) {
        Fabric.with(this, new Crashlytics());
    }
    // #=============== Iconify ================#//
    Iconify.with(new MaterialModule()).with(new MaterialCommunityModule()).with(new FontAwesomeModule());
    // #=============== Dagger ================#//
    // app injector init
    // net injector init
    mAppInjector = DaggerAppComponent.builder().appModule(new AppModule(this)).build();
    // Get default url
    String mBaseUrl = mAppInjector.sharedUserStorage().getActiveUser().getTeamcityUrl();
    // Rest api init
    if (!TextUtils.isEmpty(mBaseUrl)) {
        buildRestApiInjectorWithBaseUrl(mBaseUrl);
    }
}
Also used : AppModule(com.github.vase4kin.teamcityapp.dagger.modules.AppModule) FontAwesomeModule(com.joanzapata.iconify.fonts.FontAwesomeModule) MaterialModule(com.joanzapata.iconify.fonts.MaterialModule) Crashlytics(com.crashlytics.android.Crashlytics) MaterialCommunityModule(com.joanzapata.iconify.fonts.MaterialCommunityModule)

Example 47 with Crashlytics

use of com.crashlytics.android.Crashlytics in project iNaturalistAndroid by inaturalist.

the class INaturalistApp method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());
    FacebookSdk.sdkInitialize(getApplicationContext());
    AnalyticsClient.initAnalyticsClient(this);
    AnalyticsClient.getInstance().logEvent(AnalyticsClient.EVENT_NAME_APP_LAUNCH);
    // Build a custom Picasso instance that uses more memory for image cache (50% of free memory
    // instead of the default 15%)
    Picasso picasso = new Picasso.Builder(getApplicationContext()).memoryCache(new LruCache((int) (Runtime.getRuntime().maxMemory() * 0.5))).build();
    Picasso.setSingletonInstance(picasso);
    // Picasso.with(getApplicationContext())
    // .setIndicatorsEnabled(true);
    mNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
    INaturalistApp.context = getApplicationContext();
    deviceLocale = getResources().getConfiguration().locale;
    applyLocaleSettings();
    // Create the root offline guides directory, if needed
    GuideXML.createOfflineGuidesDirectory(this);
    SharedPreferences pref = getSharedPreferences("iNaturalistPreferences", MODE_PRIVATE);
    String username = pref.getString("username", null);
    if (username != null) {
        setShownOnboarding(true);
    }
    int missionViewCount = getPrefs().getInt("mission_view_count", 0);
    getPrefs().edit().putInt("mission_view_count", ++missionViewCount).commit();
}
Also used : SharedPreferences(android.content.SharedPreferences) LruCache(com.squareup.picasso.LruCache) Picasso(com.squareup.picasso.Picasso) Crashlytics(com.crashlytics.android.Crashlytics)

Example 48 with Crashlytics

use of com.crashlytics.android.Crashlytics in project Awful.apk by Awful.

the class AwfulApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    // initialise the AwfulPreferences singleton first since a lot of things rely on it for a Context
    mPref = AwfulPreferences.getInstance(this, this);
    appStatePrefs = this.getSharedPreferences(APP_STATE_PREFERENCES, MODE_PRIVATE);
    NetworkUtils.init(this);
    AndroidThreeTen.init(this);
    AnnouncementsManager.init();
    onPreferenceChange(mPref, null);
    // work out how long it's been since the app was updated
    long hoursSinceInstall = Long.MAX_VALUE;
    try {
        PackageInfo packageInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        long millisSinceInstall = System.currentTimeMillis() - packageInfo.lastUpdateTime;
        hoursSinceInstall = TimeUnit.HOURS.convert(millisSinceInstall, TimeUnit.MILLISECONDS);
    } catch (PackageManager.NameNotFoundException e) {
        e.printStackTrace();
    }
    Timber.i("App installed %d hours ago", hoursSinceInstall);
    // enable Crashlytics on non-debug builds, or debug builds that have been installed for a while
    crashlyticsEnabled = !BuildConfig.DEBUG || hoursSinceInstall > 4;
    if (crashlyticsEnabled) {
        Fabric.with(this, new Crashlytics());
        Timber.plant(new CrashlyticsReportingTree());
        if (mPref.sendUsernameInReport) {
            Crashlytics.setUserName(mPref.username);
        }
    } else {
        Timber.plant(new Timber.DebugTree());
    }
    if (Constants.DEBUG) {
        Timber.d("*\n*\n*Debug active\n*\n*");
        /*
			This checks destroyed cursors aren't left open, and crashes (with a log) if it finds one
			Really this is here to avoid introducing any more leaks, since there are some issues with
			too many open cursors
			*/
        StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectLeakedSqlLiteObjects().penaltyLog().penaltyDeath().build());
    }
    SyncManager.sync(this);
}
Also used : PackageManager(android.content.pm.PackageManager) PackageInfo(android.content.pm.PackageInfo) Timber(timber.log.Timber) Crashlytics(com.crashlytics.android.Crashlytics)

Example 49 with Crashlytics

use of com.crashlytics.android.Crashlytics in project ButterRemote-Android by se-bastiaan.

the class OverviewActivity method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    if (!PrefUtils.contains(this, "intro")) {
        Intent intent = new Intent(this, IntroActivity.class);
        startActivity(intent);
        finish();
    }
    setContentView(R.layout.activity_framelayout);
    ButterKnife.bind(this);
    setSupportActionBar(toolbar);
    if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) {
        toolbar.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material) + PixelUtils.getStatusBarHeight(this)));
    } else {
        toolbar.setLayoutParams(new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.MATCH_PARENT, getResources().getDimensionPixelSize(R.dimen.abc_action_bar_default_height_material)));
    }
    progressBar.setVisibility(View.GONE);
    FragmentTransaction fragmentTransaction = getSupportFragmentManager().beginTransaction();
    fragmentTransaction.setCustomAnimations(android.R.anim.fade_in, android.R.anim.fade_out);
    fragmentTransaction.replace(R.id.frameLayout, new InstanceListFragment());
    fragmentTransaction.commit();
}
Also used : FragmentTransaction(android.support.v4.app.FragmentTransaction) RelativeLayout(android.widget.RelativeLayout) Intent(android.content.Intent) InstanceListFragment(eu.se_bastiaan.popcorntimeremote.fragments.InstanceListFragment) Crashlytics(com.crashlytics.android.Crashlytics)

Example 50 with Crashlytics

use of com.crashlytics.android.Crashlytics in project androidApp by InspectorIncognito.

the class TranSappApplication method onCreate.

public void onCreate() {
    super.onCreate();
    // Set up Crashlytics, disabled for debug builds
    Crashlytics crashlyticsKit = new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build();
    // Initialize Fabric with the debug-disabled crashlytics.
    Fabric.with(this, crashlyticsKit);
    PreferenceManager.setDefaultValues(getApplicationContext(), R.xml.preference_screen, false);
    TranSappApplication.context = getApplicationContext();
    Installation.loadUserId(context);
    PositionProvider.instantiate(getApplicationContext());
    Mapbox.getInstance(this, "pk.eyJ1IjoidHJhbnNhcHAiLCJhIjoiY2lzdGloNmh6MDAzNjJ1dGt5ZnhyNHpucSJ9.Iz4LN0PlnCDawJLgbOywoA");
}
Also used : Crashlytics(com.crashlytics.android.Crashlytics)

Aggregations

Crashlytics (com.crashlytics.android.Crashlytics)51 SharedPreferences (android.content.SharedPreferences)6 Handler (android.os.Handler)6 Intent (android.content.Intent)5 Timber (timber.log.Timber)5 View (android.view.View)4 PackageInfo (android.content.pm.PackageInfo)3 PackageManager (android.content.pm.PackageManager)3 StrictMode (android.os.StrictMode)3 Fabric (io.fabric.sdk.android.Fabric)3 File (java.io.File)3 Manifest (android.Manifest)2 SuppressLint (android.annotation.SuppressLint)2 ContentUris (android.content.ContentUris)2 DialogInterface (android.content.DialogInterface)2 IntentFilter (android.content.IntentFilter)2 Bundle (android.os.Bundle)2 Environment (android.os.Environment)2 NonNull (android.support.annotation.NonNull)2 FloatingActionButton (android.support.design.widget.FloatingActionButton)2