Java Code Examples for com.google.firebase.FirebaseApp#getApplicationContext()
The following examples show how to use
com.google.firebase.FirebaseApp#getApplicationContext() .
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: FirebaseInstallations.java From firebase-android-sdk with Apache License 2.0 | 6 votes |
/** package private constructor. */ FirebaseInstallations( FirebaseApp firebaseApp, @Nullable UserAgentPublisher publisher, @Nullable HeartBeatInfo heartbeatInfo) { this( new ThreadPoolExecutor( CORE_POOL_SIZE, MAXIMUM_POOL_SIZE, KEEP_ALIVE_TIME_IN_SECONDS, TimeUnit.SECONDS, new LinkedBlockingQueue<>(), THREAD_FACTORY), firebaseApp, new FirebaseInstallationServiceClient( firebaseApp.getApplicationContext(), publisher, heartbeatInfo), new PersistedInstallation(firebaseApp), new Utils(), new IidStore(firebaseApp), new RandomFidGenerator()); }
Example 2
Source File: CrashlyticsCore.java From firebase-android-sdk with Apache License 2.0 | 6 votes |
public CrashlyticsCore( FirebaseApp app, IdManager idManager, CrashlyticsNativeComponent nativeComponent, DataCollectionArbiter dataCollectionArbiter, BreadcrumbSource breadcrumbSource, AnalyticsEventLogger analyticsEventLogger, ExecutorService crashHandlerExecutor) { this.app = app; this.dataCollectionArbiter = dataCollectionArbiter; this.context = app.getApplicationContext(); this.idManager = idManager; this.nativeComponent = nativeComponent; this.breadcrumbSource = breadcrumbSource; this.analyticsEventLogger = analyticsEventLogger; this.crashHandlerExecutor = crashHandlerExecutor; this.backgroundWorker = new CrashlyticsBackgroundWorker(crashHandlerExecutor); startTime = System.currentTimeMillis(); }
Example 3
Source File: FirebaseInAppMessagingDisplayRegistrar.java From firebase-android-sdk with Apache License 2.0 | 6 votes |
private FirebaseInAppMessagingDisplay buildFirebaseInAppMessagingUI( ComponentContainer container) { FirebaseApp firebaseApp = FirebaseApp.getInstance(); FirebaseInAppMessaging headless = container.get(FirebaseInAppMessaging.class); Application firebaseApplication = (Application) firebaseApp.getApplicationContext(); UniversalComponent universalComponent = DaggerUniversalComponent.builder() .applicationModule(new ApplicationModule(firebaseApplication)) .build(); AppComponent instance = DaggerAppComponent.builder() .universalComponent(universalComponent) .headlessInAppMessagingModule(new HeadlessInAppMessagingModule(headless)) .build(); FirebaseInAppMessagingDisplay firebaseInAppMessagingDisplay = instance.providesFirebaseInAppMessagingUI(); firebaseApplication.registerActivityLifecycleCallbacks(firebaseInAppMessagingDisplay); return firebaseInAppMessagingDisplay; }
Example 4
Source File: NetworkRequest.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
public NetworkRequest(@NonNull Uri gsUri, @NonNull FirebaseApp app) { Preconditions.checkNotNull(gsUri); Preconditions.checkNotNull(app); this.mGsUri = gsUri; this.context = app.getApplicationContext(); this.setCustomHeader(X_FIREBASE_GMPID, app.getOptions().getApplicationId()); }
Example 5
Source File: FirebaseSegmentation.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
FirebaseSegmentation(FirebaseApp firebaseApp, FirebaseInstallationsApi firebaseInstallationsApi) { this( firebaseApp, firebaseInstallationsApi, new CustomInstallationIdCache(firebaseApp), new SegmentationServiceClient(firebaseApp.getApplicationContext())); }
Example 6
Source File: FirebaseInAppMessagingRegistrar.java From firebase-android-sdk with Apache License 2.0 | 5 votes |
private FirebaseInAppMessaging providesFirebaseInAppMessaging(ComponentContainer container) { FirebaseApp firebaseApp = container.get(FirebaseApp.class); FirebaseInstallationsApi firebaseInstallations = container.get(FirebaseInstallationsApi.class); AnalyticsConnector analyticsConnector = container.get(AnalyticsConnector.class); Subscriber firebaseEventsSubscriber = container.get(Subscriber.class); Application application = (Application) firebaseApp.getApplicationContext(); UniversalComponent universalComponent = DaggerUniversalComponent.builder() .applicationModule(new ApplicationModule(application)) .appMeasurementModule( new AppMeasurementModule(analyticsConnector, firebaseEventsSubscriber)) .analyticsEventsModule(new AnalyticsEventsModule()) .programmaticContextualTriggerFlowableModule( new ProgrammaticContextualTriggerFlowableModule( new ProgramaticContextualTriggers())) .build(); AppComponent instance = DaggerAppComponent.builder() .abtIntegrationHelper( new AbtIntegrationHelper( container .get(AbtComponent.class) .get(FirebaseABTesting.OriginService.INAPP_MESSAGING))) .apiClientModule( new ApiClientModule(firebaseApp, firebaseInstallations, universalComponent.clock())) .grpcClientModule(new GrpcClientModule(firebaseApp)) .universalComponent(universalComponent) .transportFactory(container.get(TransportFactory.class)) .build(); return instance.providesFirebaseInAppMessaging(); }
Example 7
Source File: DataCollectionArbiter.java From firebase-android-sdk with Apache License 2.0 | 4 votes |
public DataCollectionArbiter(FirebaseApp app) { this.firebaseApp = app; Context applicationContext = app.getApplicationContext(); if (applicationContext == null) { throw new RuntimeException("null context"); } sharedPreferences = CommonUtils.getSharedPrefs(applicationContext); boolean enabled = true; boolean explicitlySet = false; if (sharedPreferences.contains(FIREBASE_CRASHLYTICS_COLLECTION_ENABLED)) { enabled = sharedPreferences.getBoolean(FIREBASE_CRASHLYTICS_COLLECTION_ENABLED, true); explicitlySet = true; } else { try { final PackageManager packageManager = applicationContext.getPackageManager(); if (packageManager != null) { final ApplicationInfo applicationInfo = packageManager.getApplicationInfo( applicationContext.getPackageName(), PackageManager.GET_META_DATA); if (applicationInfo != null && applicationInfo.metaData != null && applicationInfo.metaData.containsKey(FIREBASE_CRASHLYTICS_COLLECTION_ENABLED)) { enabled = applicationInfo.metaData.getBoolean(FIREBASE_CRASHLYTICS_COLLECTION_ENABLED); explicitlySet = true; } } } catch (PackageManager.NameNotFoundException e) { // This shouldn't happen since it's this app's package, but fall through to default // if so. Logger.getLogger().d("Unable to get PackageManager. Falling through", e); } } crashlyticsDataCollectionEnabled = enabled; crashlyticsDataCollectionExplicitlySet = explicitlySet; synchronized (taskLock) { if (isAutomaticDataCollectionEnabled()) { dataCollectionEnabledTask.trySetResult(null); taskResolved = true; } } }
Example 8
Source File: FirebaseDynamicLinksImpl.java From firebase-android-sdk with Apache License 2.0 | 4 votes |
public FirebaseDynamicLinksImpl(FirebaseApp firebaseApp, @Nullable AnalyticsConnector analytics) { this(new DynamicLinksApi(firebaseApp.getApplicationContext()), analytics); }