Saving Map Markers to Firebase

I’m trying to create an app that, after the user presses a button, saves their current latitude and longitude, as well as what they typed into a text input box, to Firebase - and then use that information to populate map markers. How would I save this information to Firebase in a way that would allow it to be made into map markers? How would I then take that information and turn it into map markers?

Hey @bobsunscreen,

here’s a guide to get you started with adding map markers to a project:

And to save this to Firebase, I’d recommend storing everything as an Object.

Hope that helps

Hi @domhnallohanlon, thanks for your response; I will try that!

1 Like

I tried saving the map markers as an object, but now they’re all being saved under the same data key in Firebase. Right now, when I save a new marker, it just replaces the old one. How do I make it so the new markers get saved independently, without replacing old ones? Below is my code:

You could create a list and append each new marker to the end of the list?

Or you could dynamically create new key names, and store a list of the keys? (That’s probably more complex than it needs to be)

Good idea @domhnallohanlon; I’ll try that!