5

I'm building a meeting app where users can create, join (by invite), and edit events like meetings, outings etc. Think What's app chat groups. So I'm looking into designing how the android app would stay in sync with any new or updated events that the user belongs to. Any ideas how to design this?

I have a few ideas:

1) In the database I can save all the events with a last modified date. Then when I resume the app, I will fetch all events with a last modified date greater than the last time I fetched for events. However for real time I'd need a way to push updates.

2) Use GCM and save the notifications in a local database. I can save the IDs of the events that I receive from the notification and then make a request to the server. Or I can just have the GCM pass the entire event object and save myself a server call. But I'm a bit concerned about relying on GCM this much. If any GCM notification fails, the user will never get the event.

3) Have a queue table for event transactions in the server database. Then the user can grab all the transactions and make a request to the server to grab the new/changed data. However, this seems very expensive and tables could get huge.

What do you think of these methods? Or do you think there are better ways?

  • The headline of your question is about “fetching update/syncing from server”, but in your question you mainly write about a database. This is a bit unclear. – Paramaeleon May 19 '16 at 13:09
  • Have a look at the firebase realtime database. firebase.google.com/docs/database – ElDuderino Sep 17 '16 at 10:49
1

The most simple approach I can think of is that your app does HTTP requests to your server backend, and gets the messages back, in plain text, if you want to.

https://yourdomain.example/chatBackend/getMessages?user=Bob&token=B4258CF9A&newer=20160518225524

Response:

Alice: What is the wheather in Finnland?
Alice: Do you like some ☕?

Of course, you must also write a server-side back-end. Better than querying the server over and over, long polling could be a suitable technique for you.

  • 1
    I believe the web standard is now the use of WebSockets, which do not renegotiate a TCP handshake after connection. – Akshat Mahajan Jan 14 '17 at 18:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.