Firebase Common Kotlin Extensions

Getting Started

To use the Firebase Common Android SDK with Kotlin Extensions, add the following to your app's build.gradle file:

// See maven.google.com for the latest versions
// This library transitively includes the firebase-common library
implementation 'com.google.firebase:firebase-common-ktx:$VERSION'

Features

Get the default FirebaseApp and FirebaseOptions

Kotlin

val defaultApp = FirebaseApp.getInstance()
val defaultOptions = defaultApp.options

Kotlin + KTX

val defaultApp = Firebase.app
val defaultOptions = Firebase.options

Initialize a FirebaseApp

Kotlin

val options = FirebaseApp.getInstance().options
val anotherApp = FirebaseApp.initializeApp(context, options, "myApp")

Kotlin + KTX

var anotherApp = Firebase.initialize(context, Firebase.options, "myApp")