I am using GCM service for my android chat application, sometimes the message sent without any problem and sometimes it fail without any Ack nor Nack..
I don't change any thing, the network is souitable the message is the same as the previuse...
Why does GCM send sometimes and fail sometimes in the same conditions!
point: I send many types of messages other than the chat messages thet the user write directory.
for example I send: ( online status, typing status, profile photo changed...ect)...
these messages sent to my xmpp server via GCM...
does these (many) messages make GCM stop for a while?
I set delay_while_idle = true and TTL=0
sorry for my English I hope you got me!
OK I found that it's common issue in GCM, i.e this is the behavior of GCM.. delay, random thrulling.. I can call this Bug in GCM although the GCM team see that this delays and thrulling are normal and ok ...
So I would like to find alternative...
I found one platforma that not depents to GCM :
http://www.titaniumtutorial.com/2013/10/acs-push-notification-using-gcm.html?m=1
Related
I have created an app that send messages between devices using GCM , the thing is
if i want to send several messages in a row its possible that one of the sent messages wont be sent instantly and will be delayed.
My scenario is : I have tried to send 3 messages in a row , i received the first and the third one but couldn't receive the second one !!
One day after I received the second message , how could this be possible ?
Is there any way to sync the sending ? and why it took the second message 24 hours to be received ?
Google is very clear about how you get no guarantee that a message will arrive at all.
In other words, don't depend on messages getting delivered. Your system needs to be robust enough to handle this. Perhaps periodically check. Definitely check if the backend has stored messages you did not receive yet.
If you purely rely on GCM delivering your (chat?) messages, then users will very quickly uninstall your app, because it will be faulty.
Hello I am working on a project where GCM is being used very much to notifify users for certain actions. For this sometimes in a 1 minutes server is continous pushing notification (3-4 messages) to same device.
But I noticed that I receive everytime only 1 message then other 2-3 messages are being discarded. I'm not sure if this is intentional to avoid spamming by Google ?
Does anyone have experience of it. Please share.
Thanks in advance.
If you are sending the messages from your server with the same collapse_key, the GCM server will discard some of them if it receives a message with collapse_key X before it managed to send the last message having the same collapse_key.
If you don't use collapse key, GCM server will discard some of your messages if it accumulated over a 100 messages for the same device that haven't been sent yet.
You can read more about it here.
I am developing Android app using GCM. Currently I am using standard Google libs on client and server sides.
If I am testing on two Android devices GCM works fine when both devices switched on regardless if my app is running or not.
However if Device A is switched off and I am sending messages to it from Device B, when Device A switched back on it doesn't receive any messages been sent while it was off line.
On server side (which initiates an actual send) every message to Device A has no collapse_key, time_to_live is set to 2000000 (just in case for testing purposes). Actual send has retries parameter set to 50 (in case GCM itself is unreachable, however this is unlikely).
Do I need to complete the GCM registration procedure on device boot? Currently I do so.
Please note that GCM broadcast receiver and GCMIntentService were set as well as permissions
in manifest as described on Google web site.
Any advice will be much appreciated. I really got stuck with this issue.
Sorry guys. It was my fault. Shared preferences were not loaded properly, that caused GCMIntentService to operate unproperly. Messages go in fine.
So SOLVED
Do I need to complete the GCM registration procedure on device boot?
No, you don't.
In our project we don't have any problems with receiving messages which was sent while device was switched off or ofline. We don't use any google libraries and done all as described at gcm homepage Also, we don't set any collapse_key and time_to_live for our messages.
By the way, do you process message_type? My be GCM notify you that message was deleted
why is C2DM push notification message sometimes cannot be received by
the device although the status is success?
Thanks
If the server returns a 200 success message, then the expired key is cannot be the case.
The truth is C2DM is not reliable to always send your message (it may send it with delay, if you send multiple there is a change the order will be altered, or it might not get on the other side at all).
I had a somewhat similar problem, when in my first day of sending messages I was getting the 200 status code but no messages on the device. I got the same answer that the one I'm giving you know.
Also, always make sure when you want to receive your messages that you have an internet connection.
I'm using C2DM to send notification for my android App and it is working fine. But i am able to get only one notification at a time. so that while receiving the notification, it replaces previously received notification.
So how to receive multiple C2DM notification, like receiving normal SMS?
Give the messages different collapse_keys. Here's an excerpt from the official docs:
An arbitrary string that is used to collapse a group of like messages
when the device is offline, so that only the last message gets sent to
the client. This is intended to avoid sending too many messages to the
phone when it comes back online. Note that since there is no guarantee
of the order in which messages get sent, the "last" message may not
actually be the last message sent by the application server. Required.
On a side note; you are not supposed to use the push messages too frequently:
Are you sending C2DM messages too frequently? If you need to
communicate with your application frequently over a short period of
time, C2DM is probably not the best solution. Instead, consider
implemeting XMPP or your own protocol to exchange messages, and use
C2DM only to send the initial notification.