My Android app currently uses Volley for HTTP communication with my web service built with django rest framework. My backend consists of a MySQL database and python.
The app will consist of multiple users updating the same page. I would like this page to update close to real time. When there is an update to the database (via the web service) I would like to push those updates to all connected clients. I would prefer to push the data to the clients instead of polling the server.
What is the recommended approach to syncing a database to an Android UI?
Here are some of the options I have come across:
Android Sync Adapter
Firebase Cloud Messaging (If I go this route will I need to migrate my database?)
PubNub
Is there a way to accomplish this with Volley?
I would suggest you use PubNub of the realtime data management and then use either broadcast receivers, EventBus or Otto to fire events that you listen to locally. Let me explain it bit more.
In your database, when there is a successful CRUD operation, you can publish this to the PubNub server. This will in turn fire off to your clients that are subscribers. Then in your application, you can have a android service that is running and it will then listen and process the pub nub events that are being received. At that point, you can then fire local events within your application using EventBus or Otto and have your views react to those events. Now the reason I am suggesting separating out the event management is so that if you change realtime data providers, it will require very little code change in your application since it it encapsulated in the android service and not throughout your application.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With