Jump to top

Firebase JSON Config

Configure @react-native-firebase modules

You can configure the modules creating a file named firebase.json at the root of your project directory.

JSON Schema

Add the Config Schema to your firebase.json file to use the Editor Intellisense

{
  "$schema":"./node_modules/@react-native-firebase/app/firebase-schema.json"
}

Configs

APITypeDescription
admob_android_app_id
string

The Google AdMob application App ID for Android. This can be found under: Apps > App settings > App ID on the Google AdMob dashboard. For testing purposes, use the App ID: ca-app-pub-3940256099942544~3347511713.

admob_ios_app_id
string

The Google AdMob application App ID for iOS. This can be found under: Apps > App settings > App ID on the Google AdMob dashboard. For testing purposes, use the App ID: ca-app-pub-3940256099942544~1458002511.

admob_delay_app_measurement_init
string

By default, the Google Mobile Ads SDK initializes app measurement and begins sending user-level event data to Google immediately when the app starts. This initialization behavior ensures you can enable AdMob user metricswithout making additional code changes. If you require your app users to provide consent before collecting data, setting the value to true will preventdata being sent until the firebase.admob().initialize() method has been called.

analytics_auto_collection_enabled
boolean

Disable or enable auto collection of analytics data. This is useful for opt-in-first data flows, for example when dealing with GDPR compliance. This can be overridden in JavaScript. Re-enable analytics data collection, e.g. once user has granted permission.

crashlytics_auto_collection_enabled
boolean

Additionally, you can configure whether Crashlytics sends out any reports through the auto_collection_enabled option in your firebase.json config. If you want users to opt-in, it is recommended that you disable this here and enable it later through the method once they opt-in.

crashlytics_debug_enabled
boolean

Because you have stack traces readily available while you`re debugging your app, Crashlytics is disabled by default in debug mode. You can set Crashlytics to be enabled regardless of debug mode through the debug_enabled option in your firebase.json.

crashlytics_ndk_enabled
boolean

React Native Firebase supports Crashlytics NDK reporting which is enabled by default. This allows Crashlytics to capture crashes originating from the Yoga layout engine used by React Native. You can disable Crashlytics NDK in your firebase.json config.

database_persistence_enabled
boolean

Set whether database persistence is enabled or disabled. This can be overridden in JavaScript, e.g. when requesting permission or on a condition.

in_app_messaging_auto_collection_enabled
boolean

In App Messaging can be further configured to enable or disable automatic data collection for Firebase In-App Messaging. This is useful for opt-in-first data flows, for example when dealing with GDPR compliance. This can be overridden in JavaScript.

messaging_auto_init_enabled
boolean

Firebase generates an Instance ID, which FCM uses to generate a registration token and which Analytics uses for data collection. When an Instance ID is generated, the library will upload the identifier and configuration data to Firebase. In most cases, you do not need to change this behavior. If you prefer to prevent Instance ID auto-generation, disable auto initialization for FCM and Analytics

messaging_android_headless_task_timeout
number

On Android, a background event sent to setBackgroundMessageHandler has 60 seconds to resolve before it is automatically canceled to free up device resources. If you wish to override this value, set the number of milliseconds in your config.

messaging_android_notification_channel_id
string

On Android, any message which displays a Notification use a default Notification Channel (created by FCM called Miscellaneous). This channel contains basic notification settings which may not be appropriate for your application. You can change what Channel is used by updating the messaging_android_notification_channel_id property.

messaging_android_notification_color
string

On Android, any messages which display a Notification do not use a color to tint the content (such as the small icon, title etc). To provide a custom tint color, update the messaging_android_notification_color property with a Android color resource name. The library provides a set of predefined colors corresponding to the HTML colors for convenience

messaging_ios_auto_register_for_remote_messages
boolean

Whether RNFirebase Messaging automatically calls [[UIApplication sharedApplication] registerForRemoteNotifications]; automatically on app launch (recommended) - defaults to true. If set to false; make sure to call firebase.messaging().registerDeviceForRemoteMessages() early on in your app startup - otherwise you will NOT receive remote messages/notifications in your app.

perf_auto_collection_enabled
boolean

Disable or enable auto collection of performance monitoring data collection. This is useful for opt-in-first data flows, for example when dealing with GDPR compliance. This can be overridden in JavaScript.