Search in sources :

Example 36 with Crashlytics

use of com.crashlytics.android.Crashlytics in project PhoneProfilesPlus by henrichg.

the class PPApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    PPApplication.logE("##### PPApplication.onCreate", "romManufacturer=" + romManufacturer);
    if (checkAppReplacingState())
        return;
    // Set up Crashlytics, disabled for debug builds
    Crashlytics crashlyticsKit = new Crashlytics.Builder().core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build()).build();
    Fabric.with(getApplicationContext(), crashlyticsKit);
    try {
        Crashlytics.setBool("DEBUG", BuildConfig.DEBUG);
    } catch (Exception ignored) {
    }
    // if (BuildConfig.DEBUG) {
    int actualVersionCode = 0;
    try {
        PackageInfo pInfo = getPackageManager().getPackageInfo(getPackageName(), 0);
        actualVersionCode = pInfo.versionCode;
    } catch (Exception ignored) {
    }
    Thread.setDefaultUncaughtExceptionHandler(new TopExceptionHandler(getApplicationContext(), actualVersionCode));
    // }
    // Debug.startMethodTracing("phoneprofiles");
    // resetLog();
    // firstStartServiceStarted = false;
    PACKAGE_NAME = this.getPackageName();
    LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(PPApplication.dashClockBroadcastReceiver, new IntentFilter("DashClockBroadcastReceiver"));
    LocalBroadcastManager.getInstance(getApplicationContext()).registerReceiver(PPApplication.refreshGUIBroadcastReceiver, new IntentFilter("RefreshGUIBroadcastReceiver"));
    startHandlerThread();
    startHandlerThreadVolumes();
    startHandlerThreadRadios();
    startHandlerThreadAdaptiveBrightness();
    startHandlerThreadWallpaper();
    startHandlerThreadPowerSaveMode();
    startHandlerThreadLockDevice();
    startHandlerThreadRunApplication();
    startHandlerThreadHeadsUpNotifications();
    toastHandler = new Handler(getMainLooper());
    brightnessHandler = new Handler(getMainLooper());
    screenTimeoutHandler = new Handler(getMainLooper());
    // https://github.com/evernote/android-job/issues/197
    JobConfig.setForceAllowApi14(true);
    JobManager.create(this).addJobCreator(new PPJobsCreator());
    PPApplication.initRoot();
    /*
        try {
            ViewConfiguration config = ViewConfiguration.get(this);
            Field menuKeyField = ViewConfiguration.class.getDeclaredField("sHasPermanentMenuKey");
            if(menuKeyField != null) {
                menuKeyField.setAccessible(true);
                menuKeyField.setBoolean(config, false);
            }
        } catch (Exception ex) {
            // Ignore
        }
        */
    // Log.d("PPApplication.onCreate", "memory usage (after create activateProfileHelper)=" + Debug.getNativeHeapAllocatedSize());
    // Log.d("PPApplication.onCreate","xxx");
    // Samsung Look initialization
    sLook = new Slook();
    try {
        sLook.initialize(this);
        // true = The Device supports Edge Single Mode, Edge Single Plus Mode, and Edge Feeds Mode.
        sLookCocktailPanelEnabled = sLook.isFeatureEnabled(Slook.COCKTAIL_PANEL);
    // true = The Device supports Edge Immersive Mode feature.
    // sLookCocktailBarEnabled = sLook.isFeatureEnabled(Slook.COCKTAIL_BAR);
    } catch (SsdkUnsupportedException e) {
        sLook = null;
    }
}
Also used : IntentFilter(android.content.IntentFilter) SsdkUnsupportedException(com.samsung.android.sdk.SsdkUnsupportedException) PackageInfo(android.content.pm.PackageInfo) Slook(com.samsung.android.sdk.look.Slook) Handler(android.os.Handler) Crashlytics(com.crashlytics.android.Crashlytics) SsdkUnsupportedException(com.samsung.android.sdk.SsdkUnsupportedException) IOException(java.io.IOException) SuppressLint(android.annotation.SuppressLint)

Example 37 with Crashlytics

use of com.crashlytics.android.Crashlytics in project VirtualXposed by android-hacker.

the class XApp method onCreate.

@Override
public void onCreate() {
    gApp = this;
    super.onCreate();
    VirtualCore virtualCore = VirtualCore.get();
    virtualCore.initialize(new VirtualCore.VirtualInitializer() {

        @Override
        public void onMainProcess() {
            Once.initialise(XApp.this);
            Fabric.with(XApp.this, new Crashlytics());
            boolean isXposedInstalled = false;
            try {
                isXposedInstalled = VirtualCore.get().isAppInstalled(XPOSED_INSTALLER_PACKAGE);
                File oldXposedInstallerApk = getFileStreamPath("XposedInstaller_1_24.apk");
                if (oldXposedInstallerApk.exists()) {
                    VirtualCore.get().uninstallPackage(XPOSED_INSTALLER_PACKAGE);
                    oldXposedInstallerApk.delete();
                    isXposedInstalled = false;
                    Log.d(TAG, "remove xposed installer success!");
                }
            } catch (Throwable e) {
                VLog.d(TAG, "remove xposed install failed.", e);
            }
            if (!isXposedInstalled) {
                File xposedInstallerApk = getFileStreamPath("XposedInstaller_1_31.apk");
                if (!xposedInstallerApk.exists()) {
                    InputStream input = null;
                    OutputStream output = null;
                    try {
                        input = getApplicationContext().getAssets().open("XposedInstaller_3.1.5.apk_");
                        output = new FileOutputStream(xposedInstallerApk);
                        byte[] buffer = new byte[1024];
                        int length;
                        while ((length = input.read(buffer)) > 0) {
                            output.write(buffer, 0, length);
                        }
                    } catch (Throwable e) {
                        VLog.e(TAG, "copy file error", e);
                    } finally {
                        FileUtils.closeQuietly(input);
                        FileUtils.closeQuietly(output);
                    }
                }
                if (xposedInstallerApk.isFile() && !DeviceUtil.isMeizuBelowN()) {
                    try {
                        VirtualCore.get().installPackage(xposedInstallerApk.getPath(), InstallStrategy.TERMINATE_IF_EXIST);
                    } catch (Throwable ignored) {
                    }
                }
            }
        }

        @Override
        public void onVirtualProcess() {
            Fabric.with(XApp.this, new Crashlytics());
            // listener components
            virtualCore.setComponentDelegate(new MyComponentDelegate());
            // fake phone imei,macAddress,BluetoothAddress
            virtualCore.setPhoneInfoDelegate(new MyPhoneInfoDelegate());
            // fake task description's icon and title
            virtualCore.setTaskDescriptionDelegate(new MyTaskDescDelegate());
            virtualCore.setCrashHandler(new MyCrashHandler());
            // ensure the logcat service alive when every virtual process start.
            LogcatService.start(XApp.this, VEnvironment.getDataUserPackageDirectory(0, XPOSED_INSTALLER_PACKAGE));
        }

        @Override
        public void onServerProcess() {
            virtualCore.setAppRequestListener(new MyAppRequestListener(XApp.this));
            virtualCore.addVisibleOutsidePackage("com.tencent.mobileqq");
            virtualCore.addVisibleOutsidePackage("com.tencent.mobileqqi");
            virtualCore.addVisibleOutsidePackage("com.tencent.minihd.qq");
            virtualCore.addVisibleOutsidePackage("com.tencent.qqlite");
            virtualCore.addVisibleOutsidePackage("com.facebook.katana");
            virtualCore.addVisibleOutsidePackage("com.whatsapp");
            virtualCore.addVisibleOutsidePackage("com.tencent.mm");
            virtualCore.addVisibleOutsidePackage("com.immomo.momo");
        }
    });
}
Also used : InputStream(java.io.InputStream) MyCrashHandler(io.virtualapp.delegate.MyCrashHandler) OutputStream(java.io.OutputStream) FileOutputStream(java.io.FileOutputStream) MyComponentDelegate(io.virtualapp.delegate.MyComponentDelegate) VirtualCore(com.lody.virtual.client.core.VirtualCore) MyPhoneInfoDelegate(io.virtualapp.delegate.MyPhoneInfoDelegate) MyAppRequestListener(io.virtualapp.delegate.MyAppRequestListener) Crashlytics(com.crashlytics.android.Crashlytics) FileOutputStream(java.io.FileOutputStream) MyTaskDescDelegate(io.virtualapp.delegate.MyTaskDescDelegate) File(java.io.File)

Example 38 with Crashlytics

use of com.crashlytics.android.Crashlytics in project Applozic-Android-SDK by AppLozic.

the class ApplozicSampleApplication method onCreate.

@Override
public void onCreate() {
    super.onCreate();
    Fabric.with(this, new Crashlytics());
}
Also used : Crashlytics(com.crashlytics.android.Crashlytics)

Example 39 with Crashlytics

use of com.crashlytics.android.Crashlytics in project osm-contributor by jawg.

the class OsmTemplateApplication method onCreate.

/*=========================================*/
/*---------------OVERRIDE------------------*/
/*=========================================*/
@Override
public void onCreate() {
    super.onCreate();
    if (BuildConfig.DEBUG) {
        Timber.plant(new Timber.DebugTree());
    }
    Fabric.with(this, new Crashlytics());
    // Init Stetho for debug purpose (database)
    Stetho.initializeWithDefaults(this);
    // Init Dagger
    osmTemplateComponent = DaggerOsmTemplateComponent.builder().osmTemplateModule(new OsmTemplateModule(this)).build();
    osmTemplateComponent.inject(this);
    // Init Flickr object
    StoreConfigManager configManager = new StoreConfigManager();
    flickr = new Flickr(configManager.getFlickrApiKey(), configManager.getFlickrApiKeySecret(), new REST());
    // Cache Disk for Fresco
    DiskCacheConfig diskCacheConfig = DiskCacheConfig.newBuilder(this).setBaseDirectoryPath(new File(Environment.getExternalStorageDirectory().getAbsoluteFile(), getPackageName())).setBaseDirectoryName("images").build();
    // Cache Memory for Fresco
    ImagePipelineConfig imagePipelineConfig = ImagePipelineConfig.newBuilder(this).setBitmapMemoryCacheParamsSupplier(new Supplier<MemoryCacheParams>() {

        @Override
        public MemoryCacheParams get() {
            return new MemoryCacheParams(10485760, 100, 100, 100, 100);
        }
    }).setMainDiskCacheConfig(diskCacheConfig).build();
    // Init Fresco
    Fresco.initialize(this, imagePipelineConfig);
    // Init event bus
    EventBus bus = osmTemplateComponent.getEventBus();
    bus.register(getOsmTemplateComponent().getLoginManager());
    bus.register(getOsmTemplateComponent().getEditPoiManager());
    bus.register(getOsmTemplateComponent().getPoiManager());
    bus.register(getOsmTemplateComponent().getNoteManager());
    bus.register(getOsmTemplateComponent().getSyncManager());
    bus.register(getOsmTemplateComponent().getTypeManager());
    bus.register(getOsmTemplateComponent().getPresetsManager());
    bus.register(getOsmTemplateComponent().getGeocoder());
    bus.register(getOsmTemplateComponent().getEditVectorialWayManager());
    SharedPreferences.Editor editor = PreferenceManager.getDefaultSharedPreferences(this).edit();
    if (!PreferenceManager.getDefaultSharedPreferences(this).getBoolean(getString(R.string.shared_prefs_preset_default), false)) {
        editor.putBoolean(getString(R.string.shared_prefs_preset_default), true);
    }
    editor.apply();
    MapboxAccountManager.start(this, BuildConfig.MAPBOX_TOKEN);
}
Also used : SharedPreferences(android.content.SharedPreferences) Timber(timber.log.Timber) ImagePipelineConfig(com.facebook.imagepipeline.core.ImagePipelineConfig) EventBus(org.greenrobot.eventbus.EventBus) Crashlytics(com.crashlytics.android.Crashlytics) OsmTemplateModule(io.jawg.osmcontributor.modules.OsmTemplateModule) Flickr(com.flickr4java.flickr.Flickr) REST(com.flickr4java.flickr.REST) DiskCacheConfig(com.facebook.cache.disk.DiskCacheConfig) StoreConfigManager(io.jawg.osmcontributor.utils.core.StoreConfigManager) MemoryCacheParams(com.facebook.imagepipeline.cache.MemoryCacheParams) File(java.io.File)

Example 40 with Crashlytics

use of com.crashlytics.android.Crashlytics in project BORED by invent2017.

the class Startup method onCreate.

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_startup);
    mDataRef = FirebaseDatabase.getInstance().getReference();
    checkAppStatus();
}
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