Problems with Firebase Insertion

Asked

Viewed 50 times

2

I am developing a native application on Android that uses maps, the insertion is normally happening through the code below.

Local is a variable of type LatLng.

mDataBase.child("location").child("Roubo").child(String.valueOf( new Date().getTime())).setValue(local);

Stay that way at Firebase:

inserir a descrição da imagem aqui

But I would like that after the insertion we get that way, instead of just having latitude and longitude, we also had a double called score and that later I managed to read that data: inserir a descrição da imagem aqui

1 answer

1


See if that’s what you’re looking for:

Double score = 0.0
String today = String.valueOf(new Date().getTime());

mDataBase.child("location").child("Roubo").child(today).setValue(local);
mDataBase.child("location").child("Roubo").child(today).child("score").setValue(score);

Browser other questions tagged

You are not signed in. Login or sign up in order to post.