Push Notification:

Push Notification allows an Android application to listen for messages being ‘pushed’ to it from the server.
Through Push Notification, our apps can provide uses even when they aren’t running.

Different techniques that could be used for push notifications in android:

1)  Polling:  In this technique device is polling the server on a regular basis to see if there is anything there.

untitled.bmp

Polling that heavily just to check for notification is not a good idea,that would hurt battery life pretty badly after not too long.

2)  Creating a service: In this technique service create a persistent connection to your server.
This will also drain the phone’s battery and it will create problem on server side also if you had more users

3)  SMS: In this method clients gets notified by SMS.

untitled2.bmp

This technique is better as compare to other techniques because:

1) Transfer content as soon as available
2) Save device battery
3) Reduce data traffic for user

Way to implement push via SMS:

1) Your application should add permission in manifest :
Permission:  <uses-permission android:name=”android.permission.RECEIVE_SMS” />
2) and Registers a BroadcastReceiver, either in the manifest XML or in Java, and will get control when the events occur.
<receiver android:name=”.ReceiverClass”>
<intent-filter>
<action android:name=”android.provider.Telephony.SMS_RECEIVED” />
</intent-filter>
</receiver>
3) SMS Header may contain “app port” field that is dedicated range of free usable port numbers.Port handling not yet supported in Android 1.6.
4) You’d have to parse the PDU and get the port from there manually, you can listen to all SMS messages, parse the PDU of each incoming message and see if the destination port
matches the one that you are expecting. But so can other apps.so there’s no way to ensure that just one specific app gets to know about an incoming SMS to a specific port.
5) After matching ports appliaction can handle notification with the help of notification manager.
The problem with this method is that Android currently has no way to cancel the notification that is sent by the messaging app.So for every notification your app gets, the OS will also show a text message.

about the author

Tanu

  • Tanmoy Biswas

    This is what I actually needed………
    Thanks

  • Tanmoy Biswas

    Very helpful information….

  • http://developer.xtify.com Josh Schiffman

    Xtify offers a free push notifications service for developers.

    Using our SDK and webservice, developers can easily integrate push notifications into their applications – eliminating the need to create your own service or use expensive SMS.

    With Xtify you can also set up notification triggers based on user’s location!

    check us out http://developer.xtify.com or email business@xtify.com

  • Pingback: semi's me2DAY()

  • vineet

    Hi,
    Could you please let me know how to handle DRM Content in Android, for e.g what all DRM Types are supported in Android.
    Is there anything which is similar in Android like PUSH Router of Windows Mobile.

    Thanks a Lot
    Vineet

  • Jelly

    非常非常感谢

  • Jay

    Good Post.

    On a side note. What will be the impact on performance and battery drain if a service listens to a port on the device and the servers pushes the any new content to the ip and port of the device.

    To resolve the problem of the changing ip of the device, we can always publish the ip to server whenever there is a change. Hope Android lets you register for a call back on ip change.

  • Rudy

    There is another method. Connect, and send a notification to server. The server will get your current IP address, and will initiate a connection to that listener if receive anything, and close the connection until you send a notification not to receive a push.
    You only need to do another “poll” if your IP address change to let the server knows.

  • http://www.tokudu.com Anton Lopyrev

    I’ve implemented the second solution that you mention using the MQTT protocol. I wrote a tutorial on my blog, which has sample code and a demo. Check it out, if you are interested:
    http://tokudu.com/2010/how-to-implement-push-notifications-for-android/

  • http://deaconproject.org/ Dave

    Check out the Deacon Library – http://deaconproject.org/ – it is an Android library for push notifications using the Meteor push server. Free and open source, and in need of beta testers!!

  • http://www.anontexts.com Bernard Soong

    Hi, well what can i say this was very intresting. There is some great content on your blog taking the time to share-all the best!

  • Suresh Nariya

    Hi Tanu,Nice Post!!!

  • http://www.partysuppliers.org/sitemap.xml Rocio Hardge

    My sister saved this web publication for me and I have been reading through it for the past couple hrs. This is really going to aid me and my friends for our class project. By the way, I like the way you write.

  • http://www.thisnext.com/item/A68D53F3/D70621B7/Beach-and-Pool-Inflatables?share=1 Gaylord Smeltzer

    Great post thanks! I think your articles are great and hope more Android Push Notification | Start IT up. We love anything to do with word games/word play.

  • http://dedesese.hatenablog.com/entry/2012/12/08/111510 faviana fans

    “I require a specialist in this space to solve my problem”

  • Pingback: kindle fire hd 8.9" dolby audio, dual band, wi-fi 16 GB - includes special offers.()

  • http://oudzoeterwoude.info/10/creating-by-far-the-most-out-of-low-cost-vps-hosting/ Find out

    Thanks for sharing your info. I truly appreciate your efforts and I
    am waiting for your further write ups thanks once again.

  • http://ui hju

    njihyn

  • http://www.soccerhouse.jp AirMax

    This is often a excellent web site, would you be interested in going through an interview concerning just how you produced it? If so e-mail myself!

  • http://gyratingwoe.info/product/aromafloria-for-feet.aspx Aromafloria For Feet

    Clearly reading the above blog we like the above since it’s accurate and it’s nifty to read from a webmaster that’s blogging snippets on this topic for us to think about.

  • http://siliconevitamins.info/product/allen-roth-45.html Allen Roth 45

    Now about reviewing this post plenty will like this because it is what we actually think so it is great seeing a writer that’s telling it on the internet to think about

  • http://Appspecialist.nl app Cms

    I was suggested this website via my cousin. I am no longer positive whether or not
    this put up is written by him as no one else know such
    exact about my trouble. You’re incredible! Thank you!