Guides
Plan-enterprise-icon
Expo Application Services
API Reference

FirebaseCore

Warning-icon
Deprecated: This module will no longer be available in SDK 48. Learn how to migrate to React Native Firebase.
expo-firebase-core provides access to the Firebase configuration and performs initialization of the native Firebase App.
Warning-icon
You do not have to install this library directly in your project to use Firebase. It is used as a peer dependency for the expo-firebase-analytics module when used with React Native Firebase.

Platform Compatibility

Android DeviceAndroid EmulatoriOS DeviceiOS SimulatorWeb
Status-success-iconStatus-success-iconStatus-success-iconStatus-success-iconStatus-success-icon

Installation

Terminal
→ npx expo install expo-firebase-core

If you're installing this in a bare React Native app, you should also follow these additional installation instructions.

API

import * as FirebaseCore from 'expo-firebase-core';

Constants

FirebaseCore.DEFAULT_APP_NAME

Type: string | void

Name of the default Firebase app (e.g. [DEFAULT]).

In Expo Go, a Firebase App is created for each project that is loaded, and a unique name for each project is returned.

FirebaseCore.DEFAULT_APP_OPTIONS

Type: FirebaseOptions | void

Firebase options with which the default app was initialized. If no Google services configuration was provided, undefined is returned.

Depending on the platform, the options are read from the following files and app.json keys.

PlatformFileApp.json key
iOSGoogleService-Info.plistios.googleServicesFile
Androidgoogle-services.jsonandroid.googleServicesFile
Web-web.config.firebase

Example

console.log(FirebaseCore.DEFAULT_APP_OPTIONS);
{
  appId: "1:1082251606918:ios:a2800bc715889446e24a07",
  apiKey: "AIzaXXXXXXXX-xxxxxxxxxxxxxxxxxxx",
  clientId: "000000000000-0000000000000.apps.googleusercontent.com",
  trackingId: 12345567890,
  databaseURL: "https://myexpoapp777.firebaseio.com",
  storageBucket:  "myexpoapp777.appspot.com",
  projectId: "myexpoapp777",
  messagingSenderId:  123454321
}

FirebaseCore.DEFAULT_WEB_APP_OPTIONS

Type: FirebaseOptions | void

The default Firebase options as defined in web.config.firebase in app.json.

Types

FirebaseOptions

NameTypeDescription
apiKey
(optional)
stringFirebase API key.
appId
(optional)
stringUnique identifier of the Firebase app.
authDomain
(optional)
string-
databaseURL
(optional)
stringFirebase database URL.
measurementId
(optional)
string-
messagingSenderId
(optional)
string-
projectId
(optional)
stringUnique identifier of the Firebase project.
storageBucket
(optional)
stringGoogle Cloud Storage bucket name.
trackingId
(optional)
stringTracking identifier for Google Analytics.
  • Message-iconAsk a question on the forums about FirebaseCore
  • Github-iconView open bug reports for FirebaseCore
  • Code-iconView source code for FirebaseCore
  • Build-iconView package in npm Registry
  • Edit-iconEdit this page

Was this doc helpful?