Listen Remote Database Changes
Solution 1:
In case you want to push your data from the server to your Android clients and don't want to use FCM:
You could always use web sockets, which can be a pain to implement manually on both Android and the server. For this the app should either be in the foreground or you could use a Service. We started with this library for Android: https://github.com/koush/AndroidAsync
Now, we use Pubnub for our projects, which builds on top of web sockets and gives you a way easier way to handle those. You would still need to have the receiving part in foreground or a Service. But it also gives you the possibility to use FCM (or Apples Push Service) as a fallback, which is the easiest way to receive pushed data in the background. It starts out free but then will cost you when your usage goes up. You can take a look here: https://www.pubnub.com/
Solution 2:
PubNub for Realtime Messaging
You should read this article on how to publish a message via a database trigger.
For details, see How PubNub Works here.
But to summarize for you, you simply have your clients subscribe to a channel(s) and your server publishes messages to those channels. You decide on channel names and what data to publish on them and when to publish the data.
PubNub takes care of delivering those messages to the subscribers of those channels in less 1/4 second.
You can subscribe from any platform:
That's just three of over 70 platforms that you can choose from. Free account allows up to 100 daily active devices (forever) so that you can play before you pay, if you decide to scale your app to the masses.
Post a Comment for "Listen Remote Database Changes"