Firebase Insertion Problems

2

I'm developing a native application on Android that uses maps, insertion is usually happening through the code below.

Location is a variable of type LatLng .

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

It looks like this in Firebase:

ButIwouldlikethataftertheinsertionitstaysthatway,insteadofonlyhavinglatitudeandlongitude,IalsohadadoublecalledscoreandthatlaterIwasabletoreadthisdata:

    
asked by anonymous 18.11.2017 / 14:32

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);
    
05.12.2017 / 03:35