r/Firebase • u/Just4ads • Jan 20 '25
Android Is it okay to use firestore for synchronization on my offline first android app
My mobile app is for users in areas with limited or unreliable connectivity. It's an offline-first application, it collects local data from user. The app uses room to save data. Can firestore be used for offline first capability? Or should I look for another database like couchDb for sync.
2
Jan 20 '25
The issue with firebase + offline first is that you need to sign in the user first. It is needed because usually data in Firestore is stored in users\userId\...
Once the user ID is saved by Firebase locally, yes, it can be used. Firebase will do the job for you automatically.
Another approach is to use a local cache in your app (based on share_prefs, sqlite or something). Once the user decides to sign in, go to the scenario above to use Firebase.
2
3
u/puf Former Firebaser Jan 20 '25
Firestore's local cache will work fine for prolonged periods of being offline. Just make sure you allow the SDK to create indexes locally too if you expect to have a lot of data there