3

I'm developing an android application that will allow users to find informations about the streets in my city. They will be able to register and save some streets as "favourites".

My question is, how can I use Firebase to store the streets data considering that they won't change overtime?

ReyAnthonyRenacia
  • 17,219
  • 5
  • 37
  • 56

2 Answers2

2

The Firebase data model is not well suited to storing arrays (or Java List objects). See this blog post explaining the behavior you get. Instead of storing a List, follow the Firebase documentation's approach for storing collections. This will indeed store it as a map, which is the correct approach precisely .

Ankit Patidar
  • 2,731
  • 1
  • 14
  • 22
2

That depends mostly on how you want to read the data.

If you always load all of the street data, then you might as well store it as a file on Firebase Hosting. That'll be a lot cheaper, and perform better (since the data is cached on a CDN).

If the app loads parts of the data, but it's not very dynamic, you could split the data into multiple files and still store those on Firebase Hosting.

If users sometimes update the data, but it's still hardly queries by the apps, consider storing it in Cloud Storage through the Firebase SDK. The files are available to all of your users that way.

If you want advanced querying of the data, consider storing it in the Firebase Realtime Database or in Cloud Firestore.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807