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 vote down vote up
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: StarterApplication.java    From Gazetti_Newspaper_Reader with MIT License 6 votes vote down vote up
@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 #3
Source File: CrashTest.java    From gdx-fireapp with Apache License 2.0 6 votes vote down vote up
@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 #4
Source File: LoginRegistrationActivity.java    From Password-Storage with MIT License 6 votes vote down vote up
@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 #5
Source File: Splash.java    From DeviceInfo with Apache License 2.0 6 votes vote down vote up
@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 #6
Source File: PinningTrustManager.java    From letv with Apache License 2.0 6 votes vote down vote up
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: CathodeInitProvider.java    From cathode with Apache License 2.0 6 votes vote down vote up
@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 #8
Source File: JianShiApplication.java    From jianshi with Apache License 2.0 6 votes vote down vote up
@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 #9
Source File: MainActivity.java    From MaterialTextField with Apache License 2.0 6 votes vote down vote up
@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 #10
Source File: BaseActivity.java    From KernelAdiutor with GNU General Public License v3.0 6 votes vote down vote up
@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 vote down vote up
@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 vote down vote up
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: AppController.java    From Instagram-Profile-Downloader with MIT License 5 votes vote down vote up
@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 #14
Source File: AdvertisingInfoProvider.java    From letv with Apache License 2.0 5 votes vote down vote up
private AdvertisingInfo getAdvertisingInfoFromStrategies() {
    AdvertisingInfo infoToReturn = getReflectionStrategy().getAdvertisingInfo();
    if (isInfoValid(infoToReturn)) {
        Fabric.getLogger().d(Fabric.TAG, "Using AdvertisingInfo from Reflection Provider");
    } else {
        infoToReturn = getServiceStrategy().getAdvertisingInfo();
        if (isInfoValid(infoToReturn)) {
            Fabric.getLogger().d(Fabric.TAG, "Using AdvertisingInfo from Service Provider");
        } else {
            Fabric.getLogger().d(Fabric.TAG, "AdvertisingInfo not present");
        }
    }
    return infoToReturn;
}
 
Example #15
Source File: RecordingListActivity.java    From voice-pitch-analyzer with GNU Affero General Public License v3.0 5 votes vote down vote up
@Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        Fabric.with(this, new Crashlytics());
        setContentView(R.layout.activity_recording_list);

        if (savedInstanceState == null) {

            SharedPreferences sharedPref = getSharedPreferences(
                    getString(R.string.preference_file_key), Context.MODE_PRIVATE);
            if (sharedPref.getBoolean(getString(R.string.first_start), true))
            {
                // open welcome screen
                getSupportFragmentManager().beginTransaction()
                        .add(R.id.container, new WelcomeFragment())
                        .commit();

                getSupportActionBar().hide();

                // hide welcome fragment next time the app/this activity is opened
//                SharedPreferences.Editor editor = sharedPref.edit();
                sharedPref.edit().putBoolean(getString(R.string.first_start), false).apply();
            }

            else
            {
                // open list fragment
                getSupportFragmentManager().beginTransaction()
                        .add(R.id.container, new RecordingListFragment())
                        .commit();
            }
        }
    }
 
Example #16
Source File: App.java    From twittererer with Apache License 2.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();

    JodaTimeAndroid.init(this);

    Fabric.with(this, new Crashlytics());
    Twitter.initialize(new TwitterConfig.Builder(this).twitterAuthConfig(new TwitterAuthConfig(TWITTER_KEY, TWITTER_SECRET)).build());

    applicationComponent = DaggerApp_ApplicationComponent.builder()
            .applicationModule(new ApplicationModule(this))
            .build();
}
 
Example #17
Source File: RNDigits.java    From react-native-digits with MIT License 5 votes vote down vote up
public RNDigits(ReactApplicationContext reactContext) {
  super(reactContext);
  mContext = reactContext;
  
  final TwitterAuthConfig authConfig = getTwitterConfig();
  
  final Fabric fabric = new Fabric.Builder(mContext)
    .kits(new Digits(), new TwitterCore(authConfig))
    .logger(new DefaultLogger(Log.DEBUG))
    .debuggable(true)
    .build();
  
  Fabric.with(fabric);
}
 
Example #18
Source File: AnalyticsService.java    From nano-wallet-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * Start analytics services
 */
public void start() {
    // initialize crashlytics
    Crashlytics crashlyticsKit = new Crashlytics.Builder()
            .core(new CrashlyticsCore())
            .answers(new Answers())
            .build();
    Fabric.with(context, crashlyticsKit);
}
 
Example #19
Source File: MainActivity.java    From AndroidParallax with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main_tag);

    Fabric.with(this, new Crashlytics());
}
 
Example #20
Source File: TrackingApplication.java    From KinoCast with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    //TODO Select Parser depending on settings
    SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(getApplicationContext());
    Parser.selectParser(this, preferences.getInt("parser", KinoxParser.PARSER_ID));
    Log.i("selectParser", "ID is " + Parser.getInstance().getParserId());

    new FlurryAgent.Builder()
            .withLogEnabled(true)
            .build(this, getString(R.string.FLURRY_API_KEY));

    Fabric.with(this, new Crashlytics());

    super.onCreate();
}
 
Example #21
Source File: App.java    From EasyVPN-Free with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    if (!BuildConfig.DEBUG)
        Fabric.with(this, new Crashlytics());

    instance = this;
}
 
Example #22
Source File: FFMApplication.java    From FCM-for-Mojo with GNU General Public License v3.0 5 votes vote down vote up
private static void initCrashReport(Context context) {
    Crashlytics crashlyticsKit = new Crashlytics.Builder()
            .core(new CrashlyticsCore.Builder().disabled(BuildConfig.DEBUG).build())
            .build();

    Fabric.with(context, crashlyticsKit);
}
 
Example #23
Source File: AdvertisingInfoProvider.java    From letv with Apache License 2.0 5 votes vote down vote up
private void refreshInfoIfNeededAsync(final AdvertisingInfo advertisingInfo) {
    new Thread(new BackgroundPriorityRunnable() {
        public void onRun() {
            AdvertisingInfo infoToStore = AdvertisingInfoProvider.this.getAdvertisingInfoFromStrategies();
            if (!advertisingInfo.equals(infoToStore)) {
                Fabric.getLogger().d(Fabric.TAG, "Asychronously getting Advertising Info and storing it to preferences");
                AdvertisingInfoProvider.this.storeInfoToPreferences(infoToStore);
            }
        }
    }).start();
}
 
Example #24
Source File: LoginActivity.java    From Password-Storage with MIT License 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_login);
    splashActivity=new SplashActivity();
    prop=new Properties();
    auth = FirebaseAuth.getInstance();
    appStatus=new AppStatus(getApplicationContext());
    str_getEmail = SplashActivity.sh.getString("email", null);
    str_getPass = SplashActivity.sh.getString("password", null);
    login = (Button) findViewById(R.id.btn_login);
    newuser = (Button) findViewById(R.id.newuser);
    edt_Email = (EditText) findViewById(R.id.edt_email);
    edt_Password = (EditText) findViewById(R.id.edt_password);
    progressBar=(ProgressBar)findViewById(R.id.progressBar);
    b=splashActivity.containsPass("password");
    if(b==true){
    }
    login.setOnClickListener(this);
    newuser.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            startActivity(new Intent(LoginActivity.this,RegistrationActivity.class));
        }
    });
}
 
Example #25
Source File: AppService.java    From SystemUITuner2 with MIT License 5 votes vote down vote up
@Override
public void onCreate() {
    super.onCreate();
    SharedPreferences sharedPreferences = getSharedPreferences(getResources().getText(R.string.sharedprefs_id).toString(), MODE_PRIVATE);

    if (sharedPreferences.getBoolean("useFabric", true)) {
        Fabric.with(this, new Crashlytics());
    }
    startService(new Intent(this, ShutDownListen.class).setData(Uri.parse("http://test.com")));
}
 
Example #26
Source File: AdvertisingInfoProvider.java    From letv with Apache License 2.0 5 votes vote down vote up
public AdvertisingInfo getAdvertisingInfo() {
    AdvertisingInfo infoToReturn = getInfoFromPreferences();
    if (isInfoValid(infoToReturn)) {
        Fabric.getLogger().d(Fabric.TAG, "Using AdvertisingInfo from Preference Store");
        refreshInfoIfNeededAsync(infoToReturn);
        return infoToReturn;
    }
    infoToReturn = getAdvertisingInfoFromStrategies();
    storeInfoToPreferences(infoToReturn);
    return infoToReturn;
}
 
Example #27
Source File: SplashActivity.java    From letv with Apache License 2.0 5 votes vote down vote up
private void init() {
    Fabric.with(this, new Crashlytics());
    SharedPreferences pref = getSharedPreferences("LetvActivity", 32768);
    if (!pref.contains("isFirstIn")) {
        String str = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date(System.currentTimeMillis()));
        Editor editor = pref.edit();
        editor.putString("firstRunAppTime", str);
        editor.putBoolean("isFirstIn", false);
        editor.commit();
    }
    if (BaseApplication.getAppStartTime() == 0) {
        BaseApplication.setAppStartTime(System.currentTimeMillis());
    }
    PreferencesManager.getInstance().setLesoNotification(false);
    boolean isNewApp = isNewAppVersion4Leso(PreferencesManager.getInstance().getVersionCode4Leso(), LetvUtils.getClientVersionCode());
    if (isNewApp) {
        LogInfo.log("Emerson", "--------------------isNewApp = " + isNewApp);
        PreferencesManager.getInstance().setIsShack(false);
    }
    initLesoIcon_notification(this);
    staticsCrashInfo();
    LetvApplication.getInstance().setIsShack(PreferencesManager.getInstance().isShack());
    LetvHttpConstant.setDebug(LetvConfig.isDebug());
    getDefaultImage(this);
    LetvUtils.setUa(this);
    JarUtil.sHasApplyPermissionsSuccess = true;
    if (ApkManager.getInstance().getPluginInstallState("com.letv.android.lite") != 1) {
        LogInfo.log("plugin", "重新启动了乐视视频,且liteapp之前未成功安装,重试重新下载");
        JarUtil.updatePlugin(this, 1, true);
    }
    if (LetvApplication.getInstance().hasInited()) {
        onAppInited();
    } else {
        startAppInitThread();
    }
    new RetentionRateUtils().doRequest(1);
    if (LetvConfig.isUmeng()) {
        AnalyticsConfig.setChannel(LetvConfig.getUmengID());
    }
}
 
Example #28
Source File: StartFunction.java    From ANE-Crashlytics with Apache License 2.0 5 votes vote down vote up
public FREObject call(FREContext context, FREObject[] args) {
	super.call(context, args);

       final FREContext cont = context;

       final CrashlyticsListener crashlyticsListener = new CrashlyticsListener() {
           @Override
           public void crashlyticsDidDetectCrashDuringPreviousExecution(){
               cont.dispatchStatusEventAsync(Constants.AirCrashlyticsEvent_CRASH_DETECTED_DURING_PREVIOUS_EXECUTION, "No crash data");
           }
       };
       
       boolean debugMode = getBooleanFromFREObject(args[0]);
       final CrashlyticsCore crashlyticsCore = new CrashlyticsCore
               .Builder()
               .listener(crashlyticsListener)
               .build();

       final Crashlytics crashlytics = new Crashlytics.Builder().core(crashlyticsCore).build();
       final Fabric fabric = new Fabric.Builder(context.getActivity().getApplicationContext())
               .kits(crashlytics)
               .debuggable(debugMode)
               .build();
       Fabric.with(fabric);

	return null;
}
 
Example #29
Source File: AppLifecycleCallbacks.java    From photosearcher with Apache License 2.0 5 votes vote down vote up
/**
 * setup Twitter, Crashlytics
 */
protected void setupFabric() {
    TwitterAuthConfig authConfig = new TwitterAuthConfig(
            BuildConfig.TWITTER_API_KEY,
            BuildConfig.TWITTER_API_SECRET);
    Fabric.with(mApp, new Twitter(authConfig), new Crashlytics());
}
 
Example #30
Source File: MainActivity.java    From Prodigal with Apache License 2.0 5 votes vote down vote up
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Fabric.with(this, new Crashlytics());
    setContentView(R.layout.activity_main);
    backgroundImage = (ImageView) findViewById(R.id.id_album_background);
    windowSize = new Point();
    getWindow().getWindowManager().getDefaultDisplay().getSize(windowSize);

    VibrateUtil.getStaticInstance(this);
    MediaLibrary.getStaticInstance(this);
    ResUtil.getInstance(this);
    UserDefaults ud = UserDefaults.getStaticInstance(this);

    wheelView = (WheelView) findViewById(R.id.id_wheel_view);

    permissionGranted = false;
    requestPermission();

    initOnButtonListener();

    startService();

    dumper = AIDLDumper.getInstance(this);

    if (ud.shouldShowIntro()) {
        Intent intent = new Intent(this, BDIntroActivity.class);
        startActivity(intent);
    }

    loadTheme();

}