Pulkit Pulkit - 1 year ago 102
Android Question

How do someone decide between Sync Adapter and Firebase for Android App

As Sync Adapters does is as soon as the data is changed the UI gets updated and it requires content providers to be created and Firebase does the same thing when DataBase is created on it

Edit: So what exactly should I implement in my app to sync data efficiently from the database to the UI, should I use Firebase or create my own Sync Adapter to sync the Data.

All I want to do is compare SyncAdapter and Firebase in terms of efficiency and ease of implementation and long term useage

Answer Source

It's hard to compare those two, because it's something different:

  • Firebase Realtime Database is a hosted service (=backend) from Google which comes with SDKs which make synchronization and offline usage easy. It's a third party library, not part of Android SDK.
  • SyncAdapter is part of Android SDK and it helps you create periodic synchronization with any backend.

So which one to choose? It depends on you backend - if you have existing backend, use SyncAdapter. If you are creating a new app and you don't have backend yet, Firebase might be easier for you. You don't need to do any synchronization logic, it also handles offline. However you should consider Firebase pricing.

About SyncAdapter - it's kind of obsolete part of SDK, I wouldn't use it for new app. It's also kind of pain to implement with all the Content Providers etc. Instead I would use JobScheduler API for scheduling periodic sync and also trigger sync via push messages - it's much more efficient and faster than periodic sync.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download