io.fabric.sdk.android.Fabric Java Examples
The following examples show how to use
io.fabric.sdk.android.Fabric.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: IdManager.java From letv with Apache License 2.0 | 6 votes |
public IdManager(Context appContext, String appIdentifier, String appInstallIdentifier, Collection<Kit> kits) { if (appContext == null) { throw new IllegalArgumentException("appContext must not be null"); } else if (appIdentifier == null) { throw new IllegalArgumentException("appIdentifier must not be null"); } else if (kits == null) { throw new IllegalArgumentException("kits must not be null"); } else { this.appContext = appContext; this.appIdentifier = appIdentifier; this.appInstallIdentifier = appInstallIdentifier; this.kits = kits; this.installerPackageNameProvider = new InstallerPackageNameProvider(); this.advertisingInfoProvider = new AdvertisingInfoProvider(appContext); this.collectHardwareIds = CommonUtils.getBooleanResourceValue(appContext, COLLECT_DEVICE_IDENTIFIERS, true); if (!this.collectHardwareIds) { Fabric.getLogger().d(Fabric.TAG, "Device ID collection disabled for " + appContext.getPackageName()); } this.collectUserIds = CommonUtils.getBooleanResourceValue(appContext, COLLECT_USER_IDENTIFIERS, true); if (!this.collectUserIds) { Fabric.getLogger().d(Fabric.TAG, "User information collection disabled for " + appContext.getPackageName()); } } }
Example #2
Source File: JianShiApplication.java From jianshi with Apache License 2.0 | 6 votes |
@Override public void onCreate() { super.onCreate(); appComponent = DaggerAppComponent.builder() .appModule(new AppModule(JianShiApplication.this)) .build(); final Fabric fabric = new Fabric.Builder(this) .kits(new Crashlytics()) .debuggable(true) .build(); Fabric.with(fabric); Stetho.initializeWithDefaults(this); instance = this; FlowManager.init(new FlowConfig.Builder(this).openDatabasesOnInit(true).build()); initLog(); CalligraphyConfig.initDefault(new CalligraphyConfig.Builder() .setDefaultFontPath("fonts/jianshi_default.otf") .setFontAttrId(R.attr.fontPath) .build() ); }
Example #3
Source File: LoginRegistrationActivity.java From Password-Storage with MIT License | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); setContentView(R.layout.activity_login_registration); login = (Button) findViewById(R.id.btn_login); register = (Button) findViewById(R.id.btn_register); cardView=(CardView)findViewById(R.id.layout2); splashActivity=new SplashActivity(); login.setOnClickListener(this); register.setOnClickListener(this); b=splashActivity.containsPass("password"); if(b==true) { register.setVisibility(View.INVISIBLE); cardView.setVisibility(View.INVISIBLE); } }
Example #4
Source File: CathodeInitProvider.java From cathode with Apache License 2.0 | 6 votes |
@Override public boolean onCreate() { if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); StrictMode.setVmPolicy(new StrictMode.VmPolicy.Builder().detectAll().penaltyLog().build()); StrictMode.setThreadPolicy( new StrictMode.ThreadPolicy.Builder().detectAll().permitDiskReads().penaltyLog().build()); } else { Fabric.with(getContext(), new Crashlytics()); Timber.plant(new CrashlyticsTree()); } ((CathodeApp) getContext().getApplicationContext()).ensureInjection(); AndroidInjection.inject(this); UpcomingSortByPreference.init(getContext()); UpcomingTimePreference.init(getContext()); FirstAiredOffsetPreference.init(getContext()); Upgrader.upgrade(getContext()); Accounts.setupAccount(getContext()); return true; }
Example #5
Source File: CrashTest.java From gdx-fireapp with Apache License 2.0 | 6 votes |
@Test public void initialize() { // Given PowerMockito.mockStatic(Crashlytics.class); PowerMockito.mockStatic(Fabric.class); Crash crash = new Crash(); // When crash.initialize(); crash.initialize(); crash.initialize(); // Then PowerMockito.verifyStatic(Fabric.class, VerificationModeFactory.times(1)); Fabric.with(Mockito.any(AndroidApplication.class), Mockito.any(Crashlytics.class)); PowerMockito.verifyNoMoreInteractions(Fabric.class); }
Example #6
Source File: PinningTrustManager.java From letv with Apache License 2.0 | 6 votes |
private void checkPinTrust(X509Certificate[] chain) throws CertificateException { if (this.pinCreationTimeMillis == -1 || System.currentTimeMillis() - this.pinCreationTimeMillis <= PIN_FRESHNESS_DURATION_MILLIS) { X509Certificate[] arr$ = CertificateChainCleaner.getCleanChain(chain, this.systemKeyStore); int len$ = arr$.length; int i$ = 0; while (i$ < len$) { if (!isValidPin(arr$[i$])) { i$++; } else { return; } } throw new CertificateException("No valid pins found in chain!"); } Fabric.getLogger().w(Fabric.TAG, "Certificate pins are stale, (" + (System.currentTimeMillis() - this.pinCreationTimeMillis) + " millis vs " + PIN_FRESHNESS_DURATION_MILLIS + " millis) " + "falling back to system trust."); }
Example #7
Source File: Splash.java From DeviceInfo with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); /* if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { this.getWindow().setNavigationBarColor(ContextCompat.getColor(this, R.color.colorPrimaryDark)); }*/ setContentView(R.layout.activity_splash); LottieAnimationView lottieAnimationView = findViewById(R.id.animationView); lottieAnimationView.playAnimation(); int SPLASH_TIME_OUT = 1300; new Handler().postDelayed(new Runnable() { @Override public void run() { Intent intent = new Intent(Splash.this, MainActivity.class); startActivity(intent); finish(); } }, SPLASH_TIME_OUT); }
Example #8
Source File: MainActivity.java From MaterialTextField with Apache License 2.0 | 6 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Fabric.with(this, new Crashlytics()); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); setSupportActionBar(toolbar); toolbar.setTitleTextColor(Color.WHITE); final ActionBar supportActionBar = getSupportActionBar(); if (supportActionBar != null) { supportActionBar.setDisplayHomeAsUpEnabled(true); } }
Example #9
Source File: StarterApplication.java From Gazetti_Newspaper_Reader with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); Parse.enableLocalDatastore(this); Parse.initialize(this, Constants.getConstant(this, R.string.PARSE_APP_ID), Constants.getConstant(this, R.string.PARSE_CLIENT_KEY)); Fabric.with(this, new Crashlytics()); Crashlytics.getInstance().setDebugMode(false); Crashlytics.log(Log.INFO, StarterApplication.class.getName(), "Starting Application - " + System.currentTimeMillis()); NewsCatFileUtil.getInstance(this); UserPrefUtil.getInstance(this); ParseConfig.getInBackground(new ConfigCallback() { @Override public void done(ParseConfig config, ParseException e) { ConfigService.getInstance(); ConfigService.getInstance().setInstance(StarterApplication.this); } }); }
Example #10
Source File: BaseActivity.java From KernelAdiutor with GNU General Public License v3.0 | 6 votes |
@Override protected void onCreate(@Nullable Bundle savedInstanceState) { // Don't initialize analytics with debug build if (!BuildConfig.DEBUG) { Fabric.with(this, new Crashlytics()); } AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); Utils.DARK_THEME = Themes.isDarkTheme(this); Themes.Theme theme = Themes.getTheme(this, Utils.DARK_THEME); if (Utils.DARK_THEME) { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES); } else { AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO); } setTheme(theme.getStyle()); super.onCreate(savedInstanceState); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP && setStatusBarColor()) { Window window = getWindow(); window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); window.setStatusBarColor(statusBarColor()); } }
Example #11
Source File: SaudeApp.java From Saude-no-Mapa with MIT License | 6 votes |
@Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); Timber.plant(new Timber.DebugTree()); RealmConfiguration configuration = new RealmConfiguration.Builder(this) .deleteRealmIfMigrationNeeded() .build(); Realm.setDefaultConfiguration(configuration); FacebookSdk.sdkInitialize(getApplicationContext()); Timber.i("Signature " + FacebookSdk.getApplicationSignature(getApplicationContext())); }
Example #12
Source File: FontProviderApplication.java From FontProvider with MIT License | 6 votes |
public static void init(Context context) { if (sInitialized) { return; } sInitialized = true; Crashlytics crashlyticsKit = new Crashlytics.Builder() .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()) .build(); Fabric.with(context, crashlyticsKit); FontProviderSettings.init(context); FontManager.init(context); }
Example #13
Source File: EventsFilesManager.java From letv with Apache License 2.0 | 5 votes |
public boolean rollFileOver() throws IOException { boolean fileRolledOver = false; String targetFileName = null; if (!this.eventStorage.isWorkingFileEmpty()) { targetFileName = generateUniqueRollOverFileName(); this.eventStorage.rollOver(targetFileName); CommonUtils.logControlled(this.context, 4, Fabric.TAG, String.format(Locale.US, "generated new file %s", new Object[]{targetFileName})); this.lastRollOverTime = this.currentTimeProvider.getCurrentTimeMillis(); fileRolledOver = true; } triggerRollOverOnListeners(targetFileName); return fileRolledOver; }
Example #14
Source File: ProjectApp.java From sms-ticket with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); if (!isDebugBuild()) { Fabric.with(this, new Crashlytics()); } }
Example #15
Source File: AppController.java From Instagram-Profile-Downloader with MIT License | 5 votes |
@Override public void onCreate() { super.onCreate(); PreferencesManager.init(this); DataObjectRepositry.init(this); Fabric.with(this, new Crashlytics()); MobileAds.initialize(this, getString(R.string.admob_app_id)); }
Example #16
Source File: Home.java From NightWatch with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); checkEula(); new IdempotentMigrations(getApplicationContext()).performAll(); startService(new Intent(getApplicationContext(), DataCollectionService.class)); PreferenceManager.setDefaultValues(this, R.xml.pref_general, false); PreferenceManager.setDefaultValues(this, R.xml.pref_bg_notification, false); preferenceChangeListener = new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { invalidateOptionsMenu(); } }; prefs.registerOnSharedPreferenceChangeListener(preferenceChangeListener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Intent intent = new Intent(); String packageName = getPackageName(); Log.d(this.getClass().getName(), "Maybe ignoring battery optimization"); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); if (!pm.isIgnoringBatteryOptimizations(packageName) && !prefs.getBoolean("requested_ignore_battery_optimizations", false)) { Log.d(this.getClass().getName(), "Requesting ignore battery optimization"); prefs.edit().putBoolean("requested_ignore_battery_optimizations", true).apply(); intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); intent.setData(Uri.parse("package:" + packageName)); startActivity(intent); } } }
Example #17
Source File: InstallerPackageNameProvider.java From letv with Apache License 2.0 | 5 votes |
public String getInstallerPackageName(Context appContext) { try { String name = (String) this.installerPackageNameCache.get(appContext, this.installerPackageNameLoader); if ("".equals(name)) { return null; } return name; } catch (Exception e) { Fabric.getLogger().e(Fabric.TAG, "Failed to determine installer package name", e); return null; } }
Example #18
Source File: CommonUtils.java From letv with Apache License 2.0 | 5 votes |
static Architecture getValue() { String arch = Build.CPU_ABI; if (TextUtils.isEmpty(arch)) { Fabric.getLogger().d(Fabric.TAG, "Architecture#getValue()::Build.CPU_ABI returned null or empty"); return UNKNOWN; } Architecture value = (Architecture) matcher.get(arch.toLowerCase(Locale.US)); if (value == null) { return UNKNOWN; } return value; }
Example #19
Source File: Home.java From NightWatch with GNU General Public License v3.0 | 5 votes |
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); Fabric.with(this, new Crashlytics()); prefs = PreferenceManager.getDefaultSharedPreferences(getApplicationContext()); checkEula(); new IdempotentMigrations(getApplicationContext()).performAll(); startService(new Intent(getApplicationContext(), DataCollectionService.class)); PreferenceManager.setDefaultValues(this, R.xml.pref_general, false); PreferenceManager.setDefaultValues(this, R.xml.pref_bg_notification, false); preferenceChangeListener = new OnSharedPreferenceChangeListener() { @Override public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) { invalidateOptionsMenu(); } }; prefs.registerOnSharedPreferenceChangeListener(preferenceChangeListener); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { Intent intent = new Intent(); String packageName = getPackageName(); Log.d(this.getClass().getName(), "Maybe ignoring battery optimization"); PowerManager pm = (PowerManager) getSystemService(Context.POWER_SERVICE); if (!pm.isIgnoringBatteryOptimizations(packageName) && !prefs.getBoolean("requested_ignore_battery_optimizations", false)) { Log.d(this.getClass().getName(), "Requesting ignore battery optimization"); prefs.edit().putBoolean("requested_ignore_battery_optimizations", true).apply(); intent.setAction(Settings.ACTION_REQUEST_IGNORE_BATTERY_OPTIMIZATIONS); intent.setData(Uri.parse("package:" + packageName)); startActivity(intent); } } }
Example #20
Source File: MainActivity.java From TvAppRepo with Apache License 2.0 | 5 votes |
/** * Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); Fabric.with(this, new Crashlytics()); // checkSelfVersion(); }
Example #21
Source File: Woodmin.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); Fabric.with(this, new Crashlytics()); Picasso.Builder picassoBuilder = new Picasso.Builder(getApplicationContext()); Picasso picasso = picassoBuilder.build(); //picasso.setIndicatorsEnabled(true); try { Picasso.setSingletonInstance(picasso); } catch (IllegalStateException ignored) { Log.e(LOG_TAG, "Picasso instance already used"); } }
Example #22
Source File: CrashlyticsCore.java From letv with Apache License 2.0 | 5 votes |
protected Void doInBackground() { markInitializationStarted(); this.handler.cleanInvalidTempFiles(); try { SettingsData settingsData = Settings.getInstance().awaitSettingsData(); if (settingsData == null) { Fabric.getLogger().w(TAG, "Received null settings, skipping initialization!"); } else if (settingsData.featuresData.collectReports) { this.handler.finalizeSessions(); CreateReportSpiCall call = getCreateReportSpiCall(settingsData); if (call == null) { Fabric.getLogger().w(TAG, "Unable to create a call to upload reports."); markInitializationComplete(); } else { new ReportUploader(call).uploadReports(this.delay); markInitializationComplete(); } } else { Fabric.getLogger().d(TAG, "Collection of crash reports disabled in Crashlytics settings."); markInitializationComplete(); } } catch (Exception e) { Fabric.getLogger().e(TAG, "Crashlytics encountered a problem during asynchronous initialization.", e); } finally { markInitializationComplete(); } return null; }
Example #23
Source File: CommonUtils.java From letv with Apache License 2.0 | 5 votes |
public static String resolveBuildId(Context context) { int id = getResourcesIdentifier(context, FABRIC_BUILD_ID, "string"); if (id == 0) { id = getResourcesIdentifier(context, CRASHLYTICS_BUILD_ID, "string"); } if (id == 0) { return null; } String buildId = context.getResources().getString(id); Fabric.getLogger().d(Fabric.TAG, "Build ID is: " + buildId); return buildId; }
Example #24
Source File: CrashlyticsCore.java From letv with Apache License 2.0 | 5 votes |
public void logException(Throwable throwable) { if (this.disabled || !ensureFabricWithCalled("prior to logging exceptions.")) { return; } if (throwable == null) { Fabric.getLogger().log(5, TAG, "Crashlytics is ignoring a request to log a null exception."); } else { this.handler.writeNonFatalException(Thread.currentThread(), throwable); } }
Example #25
Source File: App.java From NMSAlphabetAndroidApp with MIT License | 5 votes |
private void initFabric(){ if(Util.isConnected(this, false)) { Fabric fabric = new Fabric.Builder(this) .kits(new Crashlytics(), new Answers()) .debuggable(true) .build(); Fabric.with(fabric); } }
Example #26
Source File: FileStoreImpl.java From letv with Apache License 2.0 | 5 votes |
File prepare(File file) { if (file == null) { Fabric.getLogger().d(Fabric.TAG, "Null File"); } else if (file.exists() || file.mkdirs()) { return file; } else { Fabric.getLogger().w(Fabric.TAG, "Couldn't create file"); } return null; }
Example #27
Source File: DefaultHttpRequestFactory.java From letv with Apache License 2.0 | 5 votes |
private synchronized SSLSocketFactory initSSLSocketFactory() { SSLSocketFactory sslSocketFactory; this.attemptedSslInit = true; try { sslSocketFactory = NetworkUtils.getSSLSocketFactory(this.pinningInfo); this.logger.d(Fabric.TAG, "Custom SSL pinning enabled"); } catch (Exception e) { this.logger.e(Fabric.TAG, "Exception while validating pinned certs", e); sslSocketFactory = null; } return sslSocketFactory; }
Example #28
Source File: CrashlyticsCore.java From letv with Apache License 2.0 | 5 votes |
public boolean verifyPinning(URL url) { try { return internalVerifyPinning(url); } catch (Exception e) { Fabric.getLogger().e(TAG, "Could not verify SSL pinning", e); return false; } }
Example #29
Source File: CrashlyticsCore.java From letv with Apache License 2.0 | 5 votes |
private void checkForPreviousCrash() { if (Boolean.TRUE.equals((Boolean) this.executorServiceWrapper.executeSyncLoggingException(new CrashMarkerCheck(this.crashMarker)))) { try { this.listener.crashlyticsDidDetectCrashDuringPreviousExecution(); } catch (Exception e) { Fabric.getLogger().e(TAG, "Exception thrown by CrashlyticsListener while notifying of previous crash.", e); } } }
Example #30
Source File: StockHawkApplication.java From Stock-Hawk with Apache License 2.0 | 5 votes |
@Override public void onCreate() { super.onCreate(); if (BuildConfig.DEBUG) { Timber.plant(new Timber.DebugTree()); Fabric.with(this, new Crashlytics()); } FlowManager.init(new FlowConfig.Builder(this).build()); Stetho.initializeWithDefaults(this); }