A plugin to initialize FirebaseApp in your app.
Use this plugin with any of the following plugins:
- @nativescript/firebase-admob
- @nativescript/firebase-analytics
- @nativescript/firebase-app-check
- @nativescript/firebase-app-check-debug
- @nativescript/firebase-auth
- @nativescript/firebase-crashlytics
- @nativescript/firebase-database
- @nativescript/firebase-dynamic-links
- @nativescript/firebase-firestore
- @nativescript/firebase-functions
- @nativescript/firebase-in-app-messaging
- @nativescript/firebase-installations
- @nativescript/firebase-messaging
- @nativescript/firebase-messaging-core
- @nativescript/firebase-performance
- @nativescript/firebase-remote-config
- @nativescript/firebase-storage
Install the plugin by running the following command in the root directory of your project.
npm install @nativescript/firebase-core
To configure Firebase for Android, see Add Firebase to your Android project and follow the steps below.
-
Add a Firebase configuration file : Download the
google-services.json
file and add it toApp_Resources/Android/src
.
To set up Firebase for iOS, see Add Firebase to your Apple project and follow the steps below:
- Create a Firebase project
- Register your app with Firebase
- Add a Firebase configuration file: Download the
GoogleService-Info.plist
file and add it toApp_Resources/iOS/
.
🚨 Plugin requires both @nativescript/firebase-core
and any other @nativescript/firebase-*
plugin to successfully initialize.
Import the firebase
function and call it to create a NativeScript Firebase instance. Next, call the initializeApp
method on the Firebase instance to instantiate the native FirebaseApp.
import { firebase } from '@nativescript/firebase-core'
const defaultApp = await firebase().initializeApp();
import { firebase, FirebaseOptions } from '@nativescript/firebase-core'
const config = new FirebaseOptions()
const secondaryApp = await firebase().initializeApp(config, 'SECONDARY_APP');
Apache License Version 2.0