[ACCEPTED]-Does Android support near real time push notification?-push-notification

Accepted answer
Score: 219

Firebase Cloud Messaging FCM FAQ is the new version 10 of GCM. It inherits GCM’s core infrastructure 9 to deliver messages reliably on Android, iOS 8 and Chrome. However they'll continue to 7 support GCM because lot of developers are 6 using GCM SDKs today to handle notifications, and 5 client app upgrade takes time.

As of June 4 26, 2012, Google Cloud Messaging is the preferred way of sending 3 messages to applications running on devices.

Previously 2 (and now deprecated), the service was called 1 Cloud To Device Messaging.

Score: 51

XMPP is a good solution. I have used it for 17 a push enabled, realtime, Android application. XMPP 16 is powerful, highly extensible and easy 15 to integrate and use.

There are loads of 14 free XMPP servers (though out of courtesy 13 you shouldn't abuse them) and there are 12 open source servers you can run on one of 11 your own boxes. OpenFire is an excellent choice.

The 10 library you want isn't Smack as noted above, it's 9 aSmack. But note, this is a build environment 8 - you will have to build the library.

This 7 is a calculation I did on battery life impact 6 of an XMPP solution:

The Android client must 5 maintain a persistent TCP connection by 4 waking up periodically to send a heartbeat 3 to the XMPP server.
This clearly imposes 2 a cost in terms of power usage. An estimate 1 of this cost is provided below:

  • Using a 1400mAh battery (as supplied in the Nexus One and HTC Desire)
  • An idle device, connected to an 3G network, uses approximately 5mA
  • The wake-up, heartbeat, sleep cycle occurs every 5 minutes, takes three seconds to complete and uses 300mA
  • The cost in battery usage per hour is therefore:
    • 36 seconds 300mA = 3mAh sending heartbeat
    • 3600 seconds 5mA = 5mAh at idle
    • 4:95 + 3 = 7:95mAh combined
  • A 1400mAh battery lasts approximately 11.6 days at idle and 7.3 days when running the application, which represents an approximate 37% reduction in battery life.
  • However, a reduction in battery life of 37% represents the absolute worst case in practice given that devices are rarely completely idle.
Score: 34

I recently started playing with MQTT http://mqtt.org for 7 Android as a way of doing what you're asking 6 for (i.e. not SMS but data driven, almost 5 immediate message delivery, scalable, not 4 polling, etc.)

I have a blog post with background 3 information on this in case it's helpful 2 http://dalelane.co.uk/blog/?p=938

(Note: MQTT is an IBM technology, and I 1 should point out that I work for IBM.)

Score: 14

Have a look at the Xtify platform. Looks like 1 this is what they are doing,

Score: 12

Google is depreciating C2DM, but in its 3 place their introducing GCM (Google Cloud 2 Messaging) I dont think theirs any quota 1 and its free! It does require Android 2.2+ though! http://developer.android.com/guide/google/gcm/index.html

Score: 8

If you can depend on the Google libraries 11 being there for you target market, then 10 you may want to piggy back on GTalk functionality (registering 9 a resource on the existing username - the 8 intercepting it the messages as they come 7 in with a BroadcastReceiver).

If not, and 6 I expect you can't, then you're into bundling your own versions of XMPP. This is a 5 pain, but may be made easier if XMPP is 4 bundled separately as a standalone library.

You 3 may also consider PubSubHubub, but I have no idea the 2 network usage of it. I believe it is built 1 atop of XMPP.

Score: 8

I have been looking into this and PubSubHubBub 16 recommended by jamesh is not an option. PubSubHubBub 15 is intended for server to server communications 14

"I'm behind a NAT. Can I subscribe 13 to a Hub? The hub can't connect to me."

/Anonymous

No, PSHB 12 is a server-to-server protocol. If you're 11 behind NAT, you're not really a server. While 10 we've kicked around ideas for optional 9 PSHB extensions to do hanging gets ("long polling") and/or 8 messagebox polling for such clients, it's 7 not in the core spec. The core spec is server-to-server 6 only.

/Brad Fitzpatrick, San Francisco, CA

Source: http://moderator.appspot.com/#15/e=43e1a&t=426ac&f=b0c2d (direct 5 link not possible)

I've come to the conclusion 4 that the simplest method is to use Comet 3 HTTP push. This is both a simple and well 2 understood solution but it can also be re-used 1 for web applications.

Score: 8

There is a new open-source effort to develop 4 a Java library for push notifications on 3 Android, using the Meteor comet server as 2 a backend. You can check it out at the Deacon Project Blog. We 1 need developers, so please spread the word!

Score: 8

Google recently(18May2016) announced that Firebase is now 5 it's unified platform for mobile developers 4 including near real time push notifications.It 3 is also multi-platform :

The company now 2 offers all Firebase users free and unlimited notifications 1 with support for iOS, Android and the Web.

source

Score: 6

I cannot find where I read it at, but I 2 believe gmail utilizes an open TCP connection 1 to do the e-mail push.

Score: 6

As GTalk is gone from the SDK, it might be a 14 good idea to make a 'standard' push messaging 13 system. That way, only one service has to 12 run, only one extra tcp connection needs 11 to be open. Applications should talk to 10 this service using Intents and should first request 9 permission to send and receive notification 8 from the service. The service should then 7 notify the user a new application wants 6 to send and receive messages. The user will 5 then grant or deny permission, so he stays 4 in control. The application will then register 3 an action + category to the service, so 2 the service knows how to deliver the pushed 1 message.

Would the a good idea or not?

Score: 6

Why dont you go with the XMPP implementation. right 11 now there are so many public servers available 10 including gtalk, jabber, citadel etc. For 9 Android there is one SDK is also available 8 named as SMACK. This we cant say a push 7 notification but using the XMPP you can 6 keep a connection open between client and 5 server which will allow a two way communication. Means 4 Android client and server both can communicate 3 to each other. At present this will fulfill 2 the need of Push in android. I have implemented 1 a sample code and it really works great

Score: 6

I have recently developed http://pushdroid.org its a single 4 application that should be installed on 3 the phone just like google has implemented 2 it in 2.2 this works from 1.5 and is broadcasting 1 via intent.

Score: 4

The problem with GCM is that there is a 8 lot of configuration involved in the process:

  • You have to add a lot of boilerplate to you Android app
  • You need to configure an external server to comunicate with the GCM server
  • You will have to write tests

If 7 you like simple things (like me) you should 6 try UrbanAirship. It is (IMHO) the easiest way to use 5 GCM in your app without doing a lot of configuration. It 4 also gives you a pretty GUI to test that 3 your GCM messages are being delivered correctly.

  • You can find the docs and getting started guide here
  • You can find a sample application here

Note: I 2 am not afiliated with UrbanAirship in any 1 way

Score: 2

They have their listeners which has to be 32 used by you by using their library classes 31 in your code. You need not to bother about 30 pushing. You have to send the message to 29 server server will push the message to the 28 device. They use OAuth. Regarding Protocols, there 27 are two methods using CCS and XMPP. CCS 26 just uses XMPP as an authenticated transport 25 layer, so you can use most XMPP libraries 24 to manage the connection. To send notifications 23 to device you can write code in android 22 app to send as well as your server code. the 21 message sending will be done only by your 20 code. Rest will be taken care by Google 19 Server in GCM case. You can check detail 18 at this link

http://developer.android.com/google/gcm/server.html

Also, for security issues

google 17 cloud messaging security https://groups.google.com/forum/#!topic/android-gcm/M-EevBitbhQ

In case your app 16 is not running then also devices can recieve 15 notification because you have to write code 14 for broadcast listeners. In background it 13 will be listening to server and whenever 12 any message packet will be there it will 11 recieve the message as notification. Android 10 has service you need to not to bother about 9 it. You have only to use those resources 8 using the library class that makes your 7 work easier and let them write if your app 6 is not running then also it recieve notification. Obviously, there 5 would be some listener whick make the app 4 to recieve.Check "Recieve the message" section 3 in this link

http://developer.android.com/google/gcm/client.html

It will acccept request from 2 users also. For GCM it will do. Please check 1 "Send a message"

http://developer.android.com/google/gcm/client.html

More Related questions