Reputation: 908
My problem statement is as follows :-
I have developed Client-Server model based Application . now to Notify client for a event there may be two scenarios :-
if client is connected to server then send notification by sending data through the connected Socket.
if client is not connected then I am sending a message to client using Android's android.telephony.SmsMessage and at the client end a broadcast receiver to receive this message.
Now I want to know if there is some other way to send notification using Internet connection(data connection) . I have a solution ,to create a service which connects to the server whenever user turn on data connection and listens for notification but i think it will eat up extra resources.
I want to know how facebook or whatsApp sends notification to their users
Upvotes: 3
Views: 2596
Reputation: 1504
When I first started to program for android. I also thought to do Client-Server model but it is a very complex model to implement in android. There is something else called GCM (Google Cloud Messagning ) Service, which is used by all these big giants and by me (Small giant). Here is the link. With GCM you don´t need to be connected to client all the time. You can just send message to the client and client recieves it whenever the client has access to internet.
Upvotes: 1