0
0
Android Kotlinmobile~10 mins

Why Firebase accelerates Android development in Android Kotlin - Test Your Understanding

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to initialize Firebase in an Android app.

Android Kotlin
FirebaseApp.[1](this)
Drag options to blanks, or click blank then click option'
AinitializeApp
BstartApp
CcreateApp
DlaunchApp
Attempts:
3 left
💡 Hint
Common Mistakes
Using methods like startApp or launchApp which do not exist.
2fill in blank
medium

Complete the code to get a reference to the Firebase Realtime Database.

Android Kotlin
val database = FirebaseDatabase.[1]()
Drag options to blanks, or click blank then click option'
Ainitialize
BgetReference
Cconnect
DgetInstance
Attempts:
3 left
💡 Hint
Common Mistakes
Using getReference directly without getting the instance first.
3fill in blank
hard

Fix the error in the code to write data to Firebase Realtime Database.

Android Kotlin
database.[1]("users").setValue(user)
Drag options to blanks, or click blank then click option'
AgetReference
Breference
Cchild
Dref
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'getReference' which returns the root reference, not a child path.
Using 'reference' or 'ref' which are not valid methods here.
4fill in blank
hard

Fill both blanks to read data from Firebase Realtime Database asynchronously.

Android Kotlin
database.[1]("messages").addListenerForSingleValueEvent(object : ValueEventListener {
  override fun onDataChange(snapshot: DataSnapshot) {
    val data = snapshot.[2]()
  }
  override fun onCancelled(error: DatabaseError) {}
})
Drag options to blanks, or click blank then click option'
AgetReference
BgetValue
CgetData
DfetchValue
Attempts:
3 left
💡 Hint
Common Mistakes
Using non-existent methods like getData or fetchValue.
5fill in blank
hard

Fill all three blanks to authenticate a user with Firebase using email and password.

Android Kotlin
FirebaseAuth.[1]().[2](email, password).addOnCompleteListener { task ->
  if (task.[3]()) {
    // User signed in
  }
}
Drag options to blanks, or click blank then click option'
AgetInstance
BsignInWithEmailAndPassword
CisSuccessful
DcreateUserWithEmailAndPassword
Attempts:
3 left
💡 Hint
Common Mistakes
Using createUserWithEmailAndPassword instead of signInWithEmailAndPassword for signing in.