Reputation: 8147
In a messaging application, like android's Gmail, you can refresh the inbox manually ("check for emails") and you can also receive emails via "push notifications"
Question:
Is it too inefficient if I use GCM only for triggering events that download the data, rather than sending the data?
Approach #1
http://myserver/api/DownloadNewMessages
Approach #2
The problem I see with Approach #2 is syncing and code repeating.
Syncing: when manually downloading new data, a verification is needed (is it really new data?)
Code repeating: there will be two ways of receiving data... (and two ways of sending, in server)
Upvotes: 0
Views: 42
Reputation: 1891
I used Approach #1. It makes more sense and less error prone.
Push message is supposed to be small. It hints to the receiving client that it might be a good time to check for new message. I like the fact that it doesn't have to force the receiving client to take the data when it's not ready.
Also, it's much easier to maintain in long run when you change the data format in the future, because the GCM msg is still the same simple "Hey, there might be an update, go check if you want".
Upvotes: 1