use of org.edx.mobile.receivers.NetworkConnectivityReceiver in project edx-app-android by edx.
the class MainApplication method init.
/**
* Initializes the request manager, image cache,
* all third party integrations and shared components.
*/
private void init() {
application = this;
injector = RoboGuice.getOrCreateBaseApplicationInjector((Application) this, RoboGuice.DEFAULT_STAGE, (Module) RoboGuice.newDefaultRoboModule(this), (Module) new EdxDefaultModule(this));
injector.injectMembers(this);
// initialize Fabric
if (config.getFabricConfig().isEnabled() && !BuildConfig.DEBUG) {
Fabric.with(this, config.getFabricConfig().getKitsConfig().getEnabledKits());
if (config.getFabricConfig().getKitsConfig().isCrashlyticsEnabled()) {
EventBus.getDefault().register(new CrashlyticsCrashReportObserver());
}
if (config.getFabricConfig().getKitsConfig().isAnswersEnabled()) {
analyticsRegistry.addAnalyticsProvider(injector.getInstance(AnswersAnalytics.class));
}
}
if (config.getNewRelicConfig().isEnabled()) {
EventBus.getDefault().register(new NewRelicObserver());
}
// initialize NewRelic with crash reporting disabled
if (config.getNewRelicConfig().isEnabled()) {
// Crash reporting for new relic has been disabled
NewRelic.withApplicationToken(config.getNewRelicConfig().getNewRelicKey()).withCrashReportingEnabled(false).start(this);
}
// Add Segment as an analytics provider if enabled in the config
if (config.getSegmentConfig().isEnabled()) {
analyticsRegistry.addAnalyticsProvider(injector.getInstance(SegmentAnalytics.class));
}
// Add Firebase as an analytics provider if enabled in the config
if (config.isFirebaseEnabled()) {
analyticsRegistry.addAnalyticsProvider(injector.getInstance(FirebaseAnalytics.class));
}
registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(ConnectivityManager.CONNECTIVITY_ACTION));
registerReceiver(new NetworkConnectivityReceiver(), new IntentFilter(WifiManager.WIFI_STATE_CHANGED_ACTION));
// initialize Facebook SDK
boolean isOnZeroRatedNetwork = NetworkUtil.isOnZeroRatedNetwork(getApplicationContext(), config);
if (!isOnZeroRatedNetwork && config.getFacebookConfig().isEnabled()) {
com.facebook.Settings.setApplicationId(config.getFacebookConfig().getFacebookAppId());
}
checkIfAppVersionUpgraded(this);
// Register Font Awesome module in android-iconify library
Iconify.with(new FontAwesomeModule());
CalligraphyConfig.initDefault(new CalligraphyConfig.Builder().setDefaultFontPath("fonts/OpenSans-Regular.ttf").setFontAttrId(R.attr.fontPath).build());
// Init Branch
if (Config.FabricBranchConfig.isBranchEnabled(config.getFabricConfig())) {
Branch.getAutoInstance(this);
}
}
Aggregations