1

I am doing an secret santa app for my university project and I store users into firebase firestore, then I want to pair them randomly. I think one way to do this is to download this database as json file. Can anyone tell me how to download firestore database as json file, or another way to pair them randomly?

Thats how i authenticate and add user into database:

registerButton.setOnClickListener {
        auth.createUserWithEmailAndPassword(emailEditText.text.toString(), passwordEditText.text.toString())
            .addOnCompleteListener(this) { task ->
                if (task.isSuccessful) {
                    // Sign in success, update UI with the signed-in user's information
                    Log.d("Jemala", "createUserWithEmail:success")
                    val data = HashMap<String, Any>()
                    data["email"] = emailEditText.text.toString()
                    data["password"] = passwordEditText.text.toString()
                    data["fullname"] = fullnameEditText.text.toString()
                    val newCityRef = db.collection("people").document()
                    newCityRef.set(data)
                    Toast.makeText(this, "Registered Successfully", Toast.LENGTH_LONG).show()
                    val user = auth.currentUser
                } else {
                    // If sign in fails, display a message to the user.
                    Log.w("Jemala", "createUserWithEmail:failure", task.exception)
                    Toast.makeText(
                        baseContext, "Authentication failed.",
                        Toast.LENGTH_SHORT
                    ).show()


                }

                // ...
            }

    }
André Kool
  • 4,880
  • 12
  • 34
  • 44

0 Answers0