ChuckKelly
ChuckKelly

Reputation: 1740

Notifications System for Social Android App - Push vs. Polling & How to make a server "Push"

For those of you wanting to just cut to the chase and know what im asking. My questions are numbered and bold-ed in the paragraph below.

Im having a heck of a time trying to figure out 1.)how to implement a proper notification system for a Android social networking app? So far all ive gathered is that there are 2 choices, polling vs. pushing , pushing is better than polling bc it conserves battery and the recommended way of pushing notifications is through the Google Cloud Messaging(GCM) , but what I dont get is 2.)what makes my server push? and/or 3.)how to setup my server side to push when there is new data available? Further research has hinted that Facebook is only able to achieve their nearly real-time notification system bc they have some sort of server side api/library/technology called thrift or something like that that detects whos online and who isnt (not positive why this matters yet) . 4.)Is there anyone with some tips for me who has tried to implement a social notification system similar to Facebook ?

Other important info:

Upvotes: 3

Views: 2519

Answers (1)

Eric Brynsvold
Eric Brynsvold

Reputation: 3090

For the tasks you described (friend requests, private messages, notifications, etc), GCM is definitely the way to go. Your server will send the GCM message when the event occurs, and Google manages the sending of the message - you do not have to worry about the phone being on or anything like that.

It sounds like you're close to getting this all put together, but there is one part that is missing - the actual sending of the GCM message. There is no notion of an auto-push, at least in my experience. Each push is based off of some action occurring, like a message being sent or a new friend request. For example, if you already have code set up to handle a friend request on your server and update your database, you would just need to add a bit of code to look up the GCM ID for the requestee and send a GCM message telling your client that a friend request has been received. On the Android client side, you would have a class that extends GCMBaseIntentService that would receive this message and run whatever client side code you want to run when a friend request is received (post a local notification, update a ui, etc.)

Upvotes: 5

Related Questions