Notifications System for Android Social Apps - Push vs Poll and How to Make a "Push" Server

For those of you who just want to interrupt the chase and find out what they are asking. My questions are numbered and highlighted in the paragraph below.

I have time trying to figure out 1.) how to implement a proper notification system for android social media app? While everything is collected, there are two options: polling versus pushing, pushing is better than polling bc, it saves battery, and the recommended way of pushing notifications is through Google Cloud Messaging (GCM), but what I don't get is 2.) that makes my server push? and / or 3.) how do I configure my server side to push when there is new data?Further research has hinted that Facebook can only get an almost real-time notification system bc they have some kind of api / library / technology server side called frugality or something like that that defines whos online and who is not (not positively, why it matters). 4.) Does anyone have any hints for me trying to implement a social notification system like Facebook?

Other important information:

  • I am currently using a Codeigniter stop server for api (PHP)

  • I would prefer php solutions that I can implement using my existing API. UNLESS there is a solution in another language (Java, Ruby, Javascript) that can be implemented independently (also I can use the existing api for everything except notifications)

  • I'm not looking for someone to explain how to use GCM or direct me to a tutorial. I did some research and got a few "examples" of GCM startup notifications, but none of the tutorials I've found so far showed me how I can get my server to act on its own.

  • The types of notifications I need to make to users are things like new friend requests, new private messages from other users, new comments on content posted by the user, newbies, new comments on content that the user has commented (similar to fb notifies you if a comment is added to uve commented status)

+3


source to share


1 answer


For the tasks 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 don't have to worry about the phone being powered on or anything.



It looks like you are close to putting it all together, but there is one part that is missing - the actual sending of the GCM message. There is no concept of auto-push, at least in my experience. Each click is based on some action, such as a sent message or a new friend request. For example, if you already have code installed to handle a friend's request on your server and update the database, you just need to add some code to find the GCM ID for the requestor and send a GCM message informing your client that the friend's request has been received. On the Android client side, you will have a class that extends GCMBaseIntentService that will receive this message and execute any client side code you want to run when a friend request is received (send a local notification, update the ui, etc.)

+5


source







All Articles