use of com.crashlytics.android.answers.Answers in project Just-Another-Android-App by athkalia.
the class App method initFabric.
/**
* Setup Fabric. We also set the build time and sha key so that we can easily reproduce bug reports.
*
* Note 1: To send an exception to crashlytics use {@link Crashlytics#logException(Throwable)}. It will send a non-fatal exception.
* This is reported separately in the crashlytics dashboard. See
* https://docs.fabric.io/android/crashlytics/caught-exceptions.html?caught%20exceptions#caught-exceptions for more details.
*
* Note 2: To log a statement in Crashlytics use {@link Crashlytics#log(String)}. This log statement will appear when clicking on a
* specific crash report. For example if you have a crash that occurred 10 times, one would need to click through all 10 instances of
* that crash to see the individual log statements for every instance of this crash.
* See https://docs.fabric.io/android/crashlytics/enhanced-reports.html for more info.
*
* Note 3: To log a key-value pair in Crashlytics use {@link Crashlytics#setString(String, String)}. Same concept as logging a
* statement described in Note 2.
*/
private void initFabric() {
CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(// 'debug' builds not using fabric, 'qa' and 'release' do.
"debug".equals(BuildConfig.BUILD_TYPE)).build();
Crashlytics crashlytics = new Crashlytics.Builder().core(crashlyticsCore).build();
Answers answers = new Answers();
final Fabric fabric = new Fabric.Builder(getApplicationContext()).kits(crashlytics, answers).debuggable(// 'debug' and 'qa' build types have extra log statements, 'release' build type doesn't.
BuildConfig.DEBUG).build();
Fabric.with(fabric);
Crashlytics.setString("GIT_SHA_KEY", BuildConfig.GIT_SHA);
Crashlytics.setString("BUILD_TIME", BuildConfig.BUILD_TIME);
}
use of com.crashlytics.android.answers.Answers in project Phonograph by kabouzeid.
the class App method onCreate.
@Override
public void onCreate() {
super.onCreate();
app = this;
// default theme
if (!ThemeStore.isConfigured(this, 1)) {
ThemeStore.editTheme(this).activityTheme(R.style.Theme_Phonograph_Light).primaryColorRes(R.color.md_indigo_500).accentColorRes(R.color.md_pink_A400).commit();
}
// Set up Crashlytics, disabled for debug builds
Crashlytics crashlyticsKit = new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build();
if (!BuildConfig.DEBUG) {
Fabric.with(this, crashlyticsKit, new Answers());
} else {
// crashlytics kit is disabled here
Fabric.with(this, crashlyticsKit);
}
// Set up dynamic shortcuts
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N_MR1) {
new DynamicShortcutManager(this).initDynamicShortcuts();
}
// automatically restores purchases
billingProcessor = new BillingProcessor(this, App.GOOGLE_PLAY_LICENSE_KEY, new BillingProcessor.IBillingHandler() {
@Override
public void onProductPurchased(String productId, TransactionDetails details) {
}
@Override
public void onPurchaseHistoryRestored() {
// Toast.makeText(App.this, R.string.restored_previous_purchase_please_restart, Toast.LENGTH_LONG).show();
}
@Override
public void onBillingError(int errorCode, Throwable error) {
}
@Override
public void onBillingInitialized() {
}
});
}
use of com.crashlytics.android.answers.Answers in project Shuttle by timusus.
the class ShuttleApplication method onCreate.
@Override
public void onCreate() {
super.onCreate();
DaggerAppComponent.builder().create(this).inject(this);
if (LeakCanary.isInAnalyzerProcess(this)) {
// You should not init your app in this process.
return;
}
// Todo: Remove for production builds. Useful for tracking down crashes in beta.
RxDogTag.install();
if (BuildConfig.DEBUG) {
// enableStrictMode();
}
refWatcher = LeakCanary.install(this);
// workaround to fix InputMethodManager leak as suggested by LeakCanary lib
InputMethodManagerLeaks.fixFocusedViewLeak(this);
// Crashlytics
CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).answers(new Answers()).build());
// Firebase
FirebaseApp.initializeApp(this);
FirebaseAnalytics.getInstance(this);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(this);
// files with readAgain flag set to false, so always check KEY_HAS_SET_DEFAULT_VALUES
if (!prefs.getBoolean(PreferenceManager.KEY_HAS_SET_DEFAULT_VALUES, false)) {
PreferenceManager.setDefaultValues(this, R.xml.settings_headers, true);
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_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.incrementLaunchCount();
Completable.fromAction(() -> {
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);
}).doOnError(throwable -> LogUtils.logException(TAG, "Error updating user selected artwork", throwable)).onErrorComplete().subscribeOn(Schedulers.io()).subscribe();
Completable.timer(5, TimeUnit.SECONDS).andThen(Completable.defer(this::repairMediaStoreYearFromTags)).doOnError(throwable -> LogUtils.logException(TAG, "Failed to update year from tags", throwable)).onErrorComplete().subscribeOn(Schedulers.io()).subscribe();
Completable.timer(10, TimeUnit.SECONDS).andThen(Completable.defer(this::cleanGenres)).doOnError(throwable -> LogUtils.logException(TAG, "Failed to clean genres", throwable)).onErrorComplete().subscribeOn(Schedulers.io()).subscribe();
Completable.timer(15, TimeUnit.SECONDS).andThen(Completable.defer(this::cleanMostPlayedPlaylist)).doOnError(throwable -> LogUtils.logException(TAG, "Failed to clean most played", throwable)).onErrorComplete().subscribeOn(Schedulers.io()).subscribe();
Completable.timer(20, TimeUnit.SECONDS).andThen(Completable.defer(() -> LegacyUtils.deleteOldResources(this))).doOnError(throwable -> LogUtils.logException(TAG, "Failed to delete old resources", throwable)).onErrorComplete().subscribeOn(Schedulers.io()).subscribe();
}
Aggregations