Reputation: 145
I'm developing an android app (native) that communicates with rest api (python/flask). Is there any good ways to detect database changes and then load new data from the server?
Currently, after saving new data, the rest api sends Firebase push notifications to android clients. After client receives notification, it send broadcast message to activity (LocalBroadcastManager) and then activity knows that change have been made and it needs to load new data from the rest api. Is there any better solutions to do this?
Upvotes: 0
Views: 470
Reputation: 1073
You have a pretty clean solution. Just that instead of using a broadcast message, I would launch an IntentService to get the data from the API and send an event (using EventBus or something similar) once the data is already in the app. This is only valid if you have a local database by the way.
Upvotes: 2