Search in sources :

Example 31 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 32 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)

Example 33 with Crashlytics

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

the class HomeActivityJava 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);
    modeSpinner = (Spinner) findViewById(R.id.mode_spinner);
    bgSpinner = (Spinner) findViewById(R.id.bg_spinner);
    shapeSpinner = (Spinner) findViewById(R.id.shape_spinner);
    itemSpinner = (Spinner) findViewById(R.id.item_spinner);
    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);
    fragment1 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para1));
    fragment2 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para2));
    fragment3 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para3));
    fragment4 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para4));
    fragment5 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para5));
    fragment6 = TextFragmentKt.newTextFragmentInstance(getString(R.string.para6));
    ArrayAdapter<String> adapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Arrays.asList(new String[] { "MODE_DEFAULT", "MODE_FIXED", "MODE_SHIFTING", "MODE_FIXED_NO_TITLE", "MODE_SHIFTING_NO_TITLE" }));
    adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    modeSpinner.setAdapter(adapter);
    modeSpinner.setSelection(2);
    ArrayAdapter<String> itemAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Arrays.asList(new String[] { "3 items", "4 items", "5 items" }));
    itemAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    itemSpinner.setAdapter(itemAdapter);
    itemSpinner.setSelection(2);
    ArrayAdapter<String> shapeAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Arrays.asList(new String[] { "SHAPE_OVAL", "SHAPE_RECTANGLE", "SHAPE_HEART", "SHAPE_STAR_3_VERTICES", "SHAPE_STAR_4_VERTICES", "SHAPE_STAR_5_VERTICES", "SHAPE_STAR_6_VERTICES" }));
    shapeAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    shapeSpinner.setAdapter(shapeAdapter);
    shapeSpinner.setSelection(5);
    ArrayAdapter<String> bgAdapter = new ArrayAdapter<>(this, android.R.layout.simple_spinner_item, Arrays.asList(new String[] { "BACKGROUND_STYLE_DEFAULT", "BACKGROUND_STYLE_STATIC", "BACKGROUND_STYLE_RIPPLE" }));
    bgAdapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
    bgSpinner.setAdapter(bgAdapter);
    bgSpinner.setSelection(1);
    modeSpinner.setOnItemSelectedListener(this);
    bgSpinner.setOnItemSelectedListener(this);
    shapeSpinner.setOnItemSelectedListener(this);
    itemSpinner.setOnItemSelectedListener(this);
    autoHide.setOnCheckedChangeListener(this);
    toggleHide.setOnClickListener(this);
    toggleBadge.setOnClickListener(this);
    fabHome.setOnClickListener(this);
    bottomNavigationBar.setTabSelectedListener(this);
}
Also used : Crashlytics(com.crashlytics.android.Crashlytics) ArrayAdapter(android.widget.ArrayAdapter)

Example 34 with Crashlytics

use of com.crashlytics.android.Crashlytics in project instructure-android by instructure.

the class ApplicationManager method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());
    SharedPreferences pref = this.getSharedPreferences(PREF_FILE_NAME, MODE_PRIVATE);
    // If we don't have one, generate one.
    if (!pref.contains(APID)) {
        String uuid = UUID.randomUUID().toString();
        SharedPreferences.Editor editor = pref.edit();
        editor.putString(APID, uuid);
        editor.commit();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) Crashlytics(com.crashlytics.android.Crashlytics)

Example 35 with Crashlytics

use of com.crashlytics.android.Crashlytics in project instructure-android by instructure.

the class ApplicationManager method onCreate.

@Override
public void onCreate() {
    // Set preferences to create a pre-logged-in state. This should only be used for the 'robo' app flavor.
    if (BuildConfig.IS_ROBO_TEST)
        RoboTesting.setAppStatePrefs(this);
    super.onCreate();
    Fabric.with(this, new Crashlytics());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
        // http://code.google.com/p/android/issues/detail?id=175124
        try {
            WebView.setWebContentsDebuggingEnabled(true);
        } catch (Exception e) {
            Log.d("ParentApp", "Exception trying to setWebContentsDebuggingEnabled");
        }
    }
    SharedPreferences pref = this.getSharedPreferences(PREF_NAME, MODE_PRIVATE);
    // If we don't have one, generate one.
    if (!pref.contains("APID")) {
        String uuid = UUID.randomUUID().toString();
        SharedPreferences.Editor editor = pref.edit();
        editor.putString("APID", uuid);
        editor.apply();
    }
}
Also used : SharedPreferences(android.content.SharedPreferences) 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