Is Google Cloud Messaging GCM Reliable? - android

I am developing an application that will get some data from the server e.g. live feeds. It will be a multicast message. I just want to know if whether GCM is reliable. I don't want the notification to be on time, if the is a delay of about 1 hour then also it is OK for me. Should I try GCM or go for Web Socket. Does any popular android app use GCM? If yes then please do mention.

Neither GCM none other similar services like iOS Push notifications are 100% reliable, but those messages are usually really fast and they always work, so it depends on the level of trust you need. I'd personally go for them.

I have used GCM before, and in my experience it is very reliable.
If at all i faced any issues, they were in upstream messages (i.e from the device to the server).
I would say that you will get much better performance than 70% delivery with a one hour delay.
Go for it! :-)

Related

Push notifications arrive after a long time on some devices

On Android, I have been experiencing long push delay in some devices (minutes, half an hour). Seems like the device is asleep (but not for WhatsApp). Even on Pre-Marshmallow devices.
After a while they don't respond to push.
I have created a simple app (copied Google's Cloud Messaging client sample).
Tried to send push via The Firebase Console, setting priority to HIGH and made sure it works.
Experiment 1: After a while - tried to send. The device is not responding.
Experiment 2: Tried to use Telegram and WhatsApp. Message passes immediately on both.
Experiment 3: Tried the my test app again. Not working.
Experiment 4: Tried to downgrade from FCM to GCM and all the way to C2DM. Same thing, not working.
Any ideas?
To make it clear:
The token is okay. In most cases it works. It just falls asleep after a while.
It's a Lollipop device so no Power Saving exempts here or battery saving.
I use priority:high on the payload.
It is no server issue because I use FCM composer and it's just the same.
Waking the device does not necessarily fix it. It just begins to receive notifications minutes later and then all ok.
Other apps such as WhatsApp work without problem whatsoever, always.
I tried C2DM, GCM, FCM. I am using a printout on the C2DM receiver. They all behave the same.
I log everything. Every event, broadcast I get. I don't get push when I should.
Possible clue: some of my customers are using VMWare AirWatch. anybody know about any issues related to AirWatch and Push?
This is not a complete answer so I can't mark this question "Answered".
I found some alternative push mechanism called Pushy. It's mentioned quite a lot in Stack Overflow.
Pros:
I have made tests on a phone where FCM and GCM failed. Pushy succeeded to deliver all my messages, always.
It can work on devices with no Google Play Services enabled
It is also a workaround for the SERVICE_NOT_AVAILABLE issue.
They have a nice friendly console like in FCM, where you can send test messages.
You get a feedback when the message was delivered to Android devices.
Has topics like in FCM so you can send one message to a group.
Cons:
Money. It costs. Not too much. Last time I checked it was 0.5Cent per month for each active user. It may be a lot but my app is an emergency app so availability is a must in my case.
Does not have retries like FCM, as far as I understood. I may be wrong but it does not handle many things that FCM does. It may not do exponential back-off retries or Notification Messages A-la-Apple. I personally hate FCM behaviour on that so I am fine with this.

Implementing custom Push Service In Android

I have implemented Google most "mouth praised" GCM to an extent but got heart broken after a deep research about GCM and found out its not very reliable for PUSH which i already experienced myself after some experiments(Issues with google high heartbeat rate/closed tcp connections ..etc) it delivers messages most time very slow after a wait time of lets say 15 minutes.
So what then is the best approach to have a push notification service that best suits a chat application.
1) Do i keep requesting data from my Node js server for every particular X-interval via a service.
2) Or is there a better library. (just that i'm very skeptical about using external libraries)
I know Facebook uses MQTT but the documentation is pretty full of Chinese language.
This might be an awkward question but i have had sleepless night on this and its pissing me off.
I recommend you don't use notifications only if you want to make a chat application, because notifications not allways are delivered correctly.
Search about "Long polling" in Google, it's interesting to simulate a TCP under the 80 port and it's very simple to understand.

Send message from Server to Android device and vice versa

I want to implement a chat application. But I have a few questions, which I could not solve by searching the internet.
My requests are:
Of course I can address each device individually from my server (makes sense for a chat app)
I can create a time delay between sending and receiving a message
The application should not require a registration (this is not a MUST, but would be nice)
I wonder if GCM (Google Cloud Messaging) is the appropriate solution for me. I have not yet worked with it, so I would like to have some help. Will I run into troubles with this? And most important: Is a registration required?
You will run into troubles surely, GCM is not for creating chat applications . You will need this XMPP.GCM is kind of thing used for broadcasting messages,which does not even guarantee the delivery of messages instantaneously i.e real time which you will be requiring.
SEE THIS TOO: Android and XMPP: Currently available solutions

Send push notifications on android without using C2DM

Is it possible to send push notifications to an android application without using Google server: C2DM?
So, I would like to have my own server which sends notifications directly to the app, but I'm not sure how are the notifications perceived by the device, because the device needs to receive notifications even if the app is not running and the notifications should appear in the notification center.
I think that the guys from www.airpush.com have managed to this, but I'm not sure how.
Can anyone help me with this please?
UPDATE:
Also I would like to know how to display the notifications in the notification center if I don't use C2DM? And if it is possible to configure the notification center to receive notifications from my server even if the user deletes the application developed by us, application which registered that device to receive notifications.
I want to send 3-4 notifications a day, but these notifications need to appear in the notification center and they should go only through our server. How can I configure the notification center within the app to make requests on my server for push notifications.
Thank You!
There is a solution from UrbanAirship called Helium push. According documentation Helium:
Works on Android 1.6 and higher
Does not require a Google Account
No default pushes per day limit
No default pushes per minute limit
Works on Amazon devices (e.g., Kindle Fire)
End to end Urban Airship support (i.e., API to to device)
Best throughput
The problem is that you need development app key for using this one.
Take a look at MQTT:
MQTT stands for MQ Telemetry Transport. It is a publish/subscribe, extremely simple and lightweight messaging protocol, designed for constrained devices and low-bandwidth, high-latency or unreliable networks.
It can be used (and was used in some applications) to implement custom server push solutions. One of the most well known applications using MQTT is Facebook Messanger.
You can easily find more information on MQTT in the Internet, e.g. in this SO question or in this blog post.
According to the FAQ on airpush.com, they're not using real push notifications but rather polling the server a few times per day. One reason I think this is a viable solution for you as well is that Android's C2DM apparently makes use of the Google Play Store, so it won't work on devices distributed outside of the Google eco-system. With over 5 Million Kindle Fires having sold already, that is worth thinking about.
From Airpush FAQ:
When executed once from the main activity of an Androidâ„¢ application, the Airpush client utilizes Androidâ„¢ OS's AlarmManager framework to schedule ongoing server polling events a few times per day. If an ad is polled from the server it is cached until optimal display time, which is algorithmically determined by the server.
Without using C2DM there's not option for a "real push notification". Because (afaik, correct me if I'm wrong) an android device registers at google (they can still deinstall malware from your phone via remote) and with this ip they are able to do a push notification. All other solutions could tend to be a "register at a server, keep the connection alive and wait for requests" or something and tend to be more battery-inefficient.
Parse has an excellent push notification service for Android, very easy to setup. More info here: Parse Android Notification Doc
If you want the user to only receive 3-4 messages per day and your messages are not bound to specific arrival times, you don't need pushing mechanisms.
Just create a service in your app that checks your own web service 5-10 times a day. If there is new data, make your app display it in the notification center.
If you don't want to have a service running all the time (like many messaging apps do), you can set up alarms (using the Android AlarmManager framework) that wake your app up regularily to check for new messages to display.
And if it is possible to configure the notification center to receive
notifications from my server even if the user deletes the application
developed by us, application which registered that device to receive
notifications.
That sounds like you want to write a virus or root kit ;-) You could use e-mails for your messages instead.
UPDATE 2013-12-30:
As just noted in my comment, rebuilding what GCM does is not a nice approach. It's enough when Google Services already load the device with this functionality. If your goal is just that Google does not see what messages you send to your users, you might aswell encrypt them. For Google not being able to actually read your messages, the client app should generate a key and send it to your server. All messages you send via GCM can then be encrypted using that key.
If you just want to circumvent Google's restriction on the amount of messages sent to users, you could pack multiple messages into one GCM notification and show them one after the other. But then again, we are back at some kind of polling solution as described before, with the exception that the user does not need to have internet access when you want to show the messages as they are cached on the device.

is C2DM an Overkill or Unreliable for this?

I want to remotely change few SharedPreference settings on my App.
I have been able to achieve this using SMS messages and corresponding broadcast listeners.
Now I want to use my app web server to do the same over the internet.
My question is, is google's C2DM the right choice for this task or it it an overkill or may be even unreliable for this job?
The objective is very simple. Send some kind of notification to the app that triggers a broadcast receiver. Parse the message received and based on the keyword in the message take some action(change SharedPreference settings in this case).
Any pointers?
C2DM does have its quirks, but for this purpose, I personally think c2dm is a good idea.
However you mentioned "unreliable" - one of c2dm's major drawback.
In this introduction, it's clearly mentioned that:
C2DM makes no guarantees about delivery or the order of messages.
Although for the "overkill" part, i can guarantee that using android's c2dm architecture is way more simpler than implementing your own push notification implementation over persistent tcp/ip (check out this article).
C2DM is used for notifying really small messages like new offers,update version released etc. C2DM is loosely based for just updating app from market(now Google play), as far the reliability matters, it will not be the best choice to do it cos you have to sync your app with user's Google account, ultimately what your app server will do is, it will send message first to C2DM server and then C2DM will send the message to you and C2DM is the central for all other apps too like you, So it may happen that your message can not reach to mobile if something goes wrong to C2DM server. So its better not rely on C2DM and find your own way for push notification of your app such as when application starts it searches for any update or anything via service and do needful on based of service's response

Categories

Resources