Search in sources :

Example 1 with CrashlyticsCore

use of com.crashlytics.android.core.CrashlyticsCore in project AmazMod by edotassi.

the class CompanionApplication method onCreate.

@RequiresApi(api = Build.VERSION_CODES.JELLY_BEAN_MR1)
@SuppressLint({ "MissingSuperCall", "ResourceType" })
@DexWrap
public void onCreate() {
    Boolean enableRtl = PreferenceManager.getBoolean(this, Constants.PREFERENCE_ENABLE_RTL, false);
    Configuration configuration = getResources().getConfiguration();
    configuration.setLayoutDirection(new Locale(enableRtl ? "fa" : "en"));
    getResources().updateConfiguration(configuration, getResources().getDisplayMetrics());
    Boolean disableCrashReporting = PreferenceManager.getBoolean(this, Constants.PREFERENCE_DISABLE_CRASH_REPORTING, false);
    CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(!disableCrashReporting.booleanValue()).build();
    Fabric.with(this, new Crashlytics.Builder().core(crashlyticsCore).build());
    a = this;
    if (!Config.isOversea() && !b()) {
        return;
    }
    Box.initDefault(this);
    a();
    Log.Settings settings = Log.init();
    settings.setLogLevel(Config.isDebug() ? Log.LogLevel.FULL : Log.LogLevel.FILE_ONLY).setLogFile(StorageUtil.getLogFile(this));
    Log.d("CompanionApp", "OnAppCreate : " + AppUtil.getVersionNameAndCode(this), new Object[0]);
    super.onCreate();
    /*
        Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
            @Override
            public void uncaughtException(Thread thread, Throwable throwable) {
                Log.e("CompanionApp", "Crash(" + thread + ")", throwable, new Object[0]);
                System.exit(1);
            }
        });
        */
    Analytics.config(true, Config.isDebug(), true, this, AppUtil.getMetaDataChannel(this));
    AccountManager.getDefault(this).setTestMode(Config.isTestHosts());
    // AccountManager.getDefault(this).setGlobalMode(true);
    ActiveAndroid.initialize(this, Config.isDebug());
    NotificationManager.getManager(this).init();
    if (DeviceCompatibility.MIUI.isMIUI(this)) {
        MiuiAPI.getInstance(this).init();
    }
    SyncThrottler.init(this);
    BindUtil.unbindUnfinishedDevice(this);
    j = Transporter.get(this, "com.huami.watch.companion");
    j.addChannelListener(k);
    j.addDataListener(l);
    j.connectTransportService();
    Transporter object = Transporter.get(this, "com.huami.watch.companion.syncdata");
    object.addDataListener(m);
    object.connectTransportService();
    object = Transporter.get(this, "com.huami.action.notification");
    object.addDataListener(n);
    object.connectTransportService();
    o = Transporter.get(this, "com.huami.watch.health");
    o.addDataListener(p);
    o.connectTransportService();
    if (f == null) {
        f = new AskAndAnswer(this);
    }
    if (g == null) {
        g = new CallingWearHelper(this);
    }
    if (h == null) {
        h = new DataCollection(this);
    }
    startService(new Intent(this, BGService_msg.class));
    startService(new Intent(this, OtaService.class));
    startService(new Intent(this, IMEservice.class));
    SyncWatchFaceBgHelper.getHelper().startFileTransporter(this);
    AGpsSyncHelper.getHelper().startFileTransporter(this);
    if (DeviceManager.getManager(this).hasBoundDevice()) {
        AGpsSyncService.scheduleSync(this, "AppOnCreate");
        startService(new Intent(this, WeatherService.class));
    }
    a(this);
    SyncWatchHealthHelper.getHelper().init(this);
    SyncWatchSportHelper.getHelper().init(this);
    WearHttpSupportInterface.doInit(this);
    /* Ok */
    ConnectionReceiver connectionReceiver = new ConnectionReceiver();
    IntentFilter intentFilter = new IntentFilter();
    intentFilter.addAction("android.net.conn.CONNECTIVITY_CHANGE");
    intentFilter.addAction("com.huami.watch.WATCH_CONNED_4_COMPANION");
    intentFilter.addAction("com.huami.watch.companion.action.UnbindDeviceStart");
    intentFilter.addAction("com.huami.watch.httpsupport.COLLECT_DATA");
    intentFilter.addAction("com.huami.watch.companion.action.HOST_START_SYNC_DATA");
    registerReceiver(connectionReceiver, intentFilter);
    TimeChangedReceiver timeChangedReceiver = new CompanionApplication.TimeChangedReceiver();
    IntentFilter timeSet = new IntentFilter("android.intent.action.TIME_SET");
    timeSet.addAction("android.intent.action.TIMEZONE_CHANGED");
    registerReceiver(timeChangedReceiver, timeSet);
    IntentFilter wifiStateChangeConnectivityChange = new IntentFilter();
    wifiStateChangeConnectivityChange.addAction("android.net.wifi.STATE_CHANGE");
    wifiStateChangeConnectivityChange.addAction("android.net.conn.CONNECTIVITY_CHANGE");
    registerReceiver(q, wifiStateChangeConnectivityChange);
    new RxConsumerStarter().init(this);
    BindUtil.connectCurrentDevice(this);
    Device device = DeviceManager.getManager(this).getCurrentDevice();
    if (device != null && DeviceUtil.hasEmptyInfo(device)) {
        SyncDeviceInfoHelper.getHelper(this).startAsync();
    }
    PlayFlavor.initApp(this);
    e = new HttpProxyServer(getApplicationContext());
    e.init();
    if (getResources().getBoolean(2131427330)) {
        CommandHandler.getInstance(this);
    }
    WatchWifiFtpUtil.init(getApplicationContext());
    registerActivityLifecycleCallbacks(new AppEnterForegroundCallBack());
    BleLostWarningManager.init(getApplicationContext());
    if (DeviceCompatibility.isHuaWeiPhone() && !DeviceCompatibility.isO()) {
    // DummyJobService.startSchedule(this);
    }
    FileDownloader.init(getApplicationContext(), new DownloadMgrInitialParams.InitCustomMaker().connectionCreator(new FileDownloadUrlConnection.Creator(new FileDownloadUrlConnection.Configuration().connectTimeout(15000).readTimeout(15000).proxy(Proxy.NO_PROXY))));
    Boot.sharedInstance(this).run();
}
Also used : Locale(java.util.Locale) CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Configuration(android.content.res.Configuration) CallingWearHelper(com.huami.watch.companion.wearcalling.CallingWearHelper) IMEservice(com.huami.watch.companion.IME.IMEservice) AskAndAnswer(com.huami.watch.companion.findphone.AskAndAnswer) WeatherService(com.huami.watch.companion.weather.WeatherService) AppEnterForegroundCallBack(com.huami.watch.companion.util.AppEnterForegroundCallBack) IntentFilter(android.content.IntentFilter) HttpProxyServer(com.huami.watch.companion.components.bluetoothproxyserver.HttpProxyServer) OtaService(com.huami.watch.companion.otaphone.service.OtaService) Log(com.huami.watch.util.Log) ConnectionReceiver(com.huami.watch.transport.httpsupport.global.ConnectionReceiver) Device(com.huami.watch.companion.device.Device) Intent(android.content.Intent) Crashlytics(com.crashlytics.android.Crashlytics) DataCollection(com.huami.watch.companion.datacollection.DataCollection) BGService_msg(com.huami.watch.hmwatchmanager.bt_connect.BGService_msg) Transporter(com.huami.watch.transport.Transporter) DexWrap(lanchon.dexpatcher.annotation.DexWrap) RequiresApi(android.support.annotation.RequiresApi) SuppressLint(android.annotation.SuppressLint)

Example 2 with CrashlyticsCore

use of com.crashlytics.android.core.CrashlyticsCore 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);
}
Also used : CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Answers(com.crashlytics.android.answers.Answers) Fabric(io.fabric.sdk.android.Fabric) Crashlytics(com.crashlytics.android.Crashlytics)

Example 3 with CrashlyticsCore

use of com.crashlytics.android.core.CrashlyticsCore in project xabber-android by redsolution.

the class ExternalAPIs method enableCrashlyticsIfNeed.

public static void enableCrashlyticsIfNeed(Context context) {
    CrashlyticsCore crashlyticsCore = new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build();
    Fabric.with(context, new Crashlytics.Builder().core(crashlyticsCore).build());
}
Also used : CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Crashlytics(com.crashlytics.android.Crashlytics)

Example 4 with CrashlyticsCore

use of com.crashlytics.android.core.CrashlyticsCore 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();
}
Also used : ContentProviderOperation(android.content.ContentProviderOperation) Genre(com.simplecity.amp_library.model.Genre) PackageManager(android.content.pm.PackageManager) CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Completable(io.reactivex.Completable) PlayCountTable(com.simplecity.amp_library.sql.providers.PlayCountTable) AnalyticsManager(com.simplecity.amp_library.utils.AnalyticsManager) UserSelectedArtwork(com.simplecity.amp_library.model.UserSelectedArtwork) Manifest(android.Manifest) AudioFile(org.jaudiotagger.audio.AudioFile) MediaStore(android.provider.MediaStore) Schedulers(io.reactivex.schedulers.Schedulers) Log(android.util.Log) FirebaseAnalytics(com.google.firebase.analytics.FirebaseAnalytics) FieldKey(org.jaudiotagger.tag.FieldKey) LogUtils(com.simplecity.amp_library.utils.LogUtils) AndroidInjector(dagger.android.AndroidInjector) ContextCompat(android.support.v4.content.ContextCompat) Logger(java.util.logging.Logger) SettingsManager(com.simplecity.amp_library.utils.SettingsManager) PreferenceManager(android.support.v7.preference.PreferenceManager) Query(com.simplecity.amp_library.model.Query) List(java.util.List) GenreExtKt(com.simplecity.amp_library.utils.extensions.GenreExtKt) TagException(org.jaudiotagger.tag.TagException) Fabric(io.fabric.sdk.android.Fabric) AudioFileIO(org.jaudiotagger.audio.AudioFileIO) InvalidAudioFrameException(org.jaudiotagger.audio.exceptions.InvalidAudioFrameException) ContentValues(android.content.ContentValues) Answers(com.crashlytics.android.answers.Answers) SqlUtils(com.simplecity.amp_library.sql.SqlUtils) ReadOnlyFileException(org.jaudiotagger.audio.exceptions.ReadOnlyFileException) CannotReadException(org.jaudiotagger.audio.exceptions.CannotReadException) TagOptionSingleton(org.jaudiotagger.tag.TagOptionSingleton) Stream(com.annimon.stream.Stream) Environment(android.os.Environment) RefWatcher(com.squareup.leakcanary.RefWatcher) DaggerApplication(dagger.android.DaggerApplication) HashMap(java.util.HashMap) NonNull(android.support.annotation.NonNull) StringUtils(com.simplecity.amp_library.utils.StringUtils) InputMethodManagerLeaks(com.simplecity.amp_library.utils.InputMethodManagerLeaks) RxDogTag(com.uber.rxdogtag.RxDogTag) ArrayList(java.util.ArrayList) Level(java.util.logging.Level) Inject(javax.inject.Inject) Repository(com.simplecity.amp_library.data.Repository) Observable(io.reactivex.Observable) DaggerAppComponent(com.simplecity.amp_library.di.app.DaggerAppComponent) SqlBriteUtils(com.simplecity.amp_library.sql.sqlbrite.SqlBriteUtils) TextUtils(android.text.TextUtils) IOException(java.io.IOException) Tag(org.jaudiotagger.tag.Tag) CustomArtworkTable(com.simplecity.amp_library.sql.databases.CustomArtworkTable) File(java.io.File) TimeUnit(java.util.concurrent.TimeUnit) Glide(com.bumptech.glide.Glide) SharedPreferences(android.content.SharedPreferences) StrictMode(android.os.StrictMode) Crashlytics(com.crashlytics.android.Crashlytics) LeakCanary(com.squareup.leakcanary.LeakCanary) LegacyUtils(com.simplecity.amp_library.utils.LegacyUtils) Collections(java.util.Collections) ContentUris(android.content.ContentUris) FirebaseApp(com.google.firebase.FirebaseApp) CrashlyticsCore(com.crashlytics.android.core.CrashlyticsCore) Answers(com.crashlytics.android.answers.Answers) Query(com.simplecity.amp_library.model.Query) SharedPreferences(android.content.SharedPreferences) UserSelectedArtwork(com.simplecity.amp_library.model.UserSelectedArtwork)

Aggregations

Crashlytics (com.crashlytics.android.Crashlytics)4 CrashlyticsCore (com.crashlytics.android.core.CrashlyticsCore)4 Answers (com.crashlytics.android.answers.Answers)2 Manifest (android.Manifest)1 SuppressLint (android.annotation.SuppressLint)1 ContentProviderOperation (android.content.ContentProviderOperation)1 ContentUris (android.content.ContentUris)1 ContentValues (android.content.ContentValues)1 Intent (android.content.Intent)1 IntentFilter (android.content.IntentFilter)1 SharedPreferences (android.content.SharedPreferences)1 PackageManager (android.content.pm.PackageManager)1 Configuration (android.content.res.Configuration)1 Environment (android.os.Environment)1 StrictMode (android.os.StrictMode)1 MediaStore (android.provider.MediaStore)1 NonNull (android.support.annotation.NonNull)1 RequiresApi (android.support.annotation.RequiresApi)1 ContextCompat (android.support.v4.content.ContextCompat)1 PreferenceManager (android.support.v7.preference.PreferenceManager)1