I created an iOS
app that stores the data to Firebase realtime database like this:
users
- ID
-- Email: "test@domain.com"
-- UsersName: "test"
-- Level: 1
-- XP: 0
Now I started with Android development using Kotlin and the data is stored with the first letter of the values name lowercased like this:
users
- ID
-- email: "test@domain.com"
-- usersName: "test" (No mistake, the N is uppercased)
-- level: 1
-- xp: 0 (No mistake, the P is lowercase)
This is my code:
data class User(var UsersName: String = "",
var XP: Int = 0,
var Level: Int = 1,
var Email: String = "")
private fun saveUserToFirebaseDatabase(){
val uid = FirebaseAuth.getInstance().uid ?: ""
val ref = FirebaseDatabase.getInstance().getReference("users/$uid")
val mDatabase = FirebaseDatabase.getInstance().getReference();
val username = usernameSignUp.text.toString()
val user = User(username, 0, 1, SignUpEmailtext.text.toString())
print(user)
mDatabase.child("users").child(uid).setValue(user)
.addOnSuccessListener {
}
.addOnFailureListener{
}
}
I expect the names of the values to be exactly how they are named in the class (like the iOS app saves them).