GCM only works 1 time after send heartbeat - android

I am facing a problem with using GCM as chat. User A can receive as many GCM as possible, if he does not reply. However, when User A tries to reply, after a few times both party sending message to each other, they will stop receiving GCM. I tried to look around and see a solution when sending Heartbeat every 2 minutes. However, after sending the Heartbeat, I will only receive GCM 1 more time until the next heartbeat is sent.
Currently, to fix this, I have to change network state (change to mobile network, or turn off then turn on Wifi again). How can I overcome this problem?

Related

Firebase push notifications not working when internet connectivity is switched from off to on

when I send notifications to users having no connectivity at that particular instant (when i send the notification) and then user turns their mobile data ON ,no notification is received on the user end. I will provide code if necessary.
Any suggestions would be extremely helpful.
I'm having the same issue. The main goal is in that, that your message will be sent several times by firebase, by default send period is 4 weeks, untill your notification will arrive. That's from documentation. Hope, my answer was helpful

GCM Messages not Syncronized

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.

Gcm delivery not guaranteed

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

How do I keep a user permanently online with Smack on Android?

Okay here is my problem where i am stuck for so many days.
I am developing a simple chat application with the help of XMPP client - SMACK.
Everything works fine for me normal chat process from one friend to another, also added the notification part.
What i am not able to do is if i forcibly close my application the whole session with SMACK stops.
I am not able to send the message to the user who had closed the application.
Now, how do i keep the status of the user permanently online so the he can also receive messages even if he had closed the application.
You can't. If the application is closed, the user is no longer online and the server knows that. You can still send them messages, but it is the servers job to store offline messages, but that means the server has to be configured to do so.
They can be retrieved once the user connects again.
Here are a couple of suggestions to work around the problem
Have a go at implementing either:
A long running service that connects every x minutes (polling solution) I personally advise against this as it's a drain on network and battery.
Implement GCM in your app and server.
It wakes up the app when a message is sent and connects to the server to retrieve the payload. (in fact with GCM over C2DM you can send the payload over google and not even have to connect but I steer clear of this)

C2DM to GCM code Migration

I have migrated my code for push notifications from C2DM to GCM. The only change I have made on client side is replacing the email account passed in the sender parameter of the registration intent with the project ID. The server side changes have been done too.
However, I experience a delay in receiving push while using GCM. The delay is like for 1 - 2 mins. I did not experience the same delay while using C2DM.
Please help!! Is this problem cause of GCM, or am I missing something.
I've set up GCM and pushes are almost instant. Couple things to check is that your server is sending it without a delay. And also that you are not spamming it, i noticed that after a certain amount of pushes in a small time period, and Google will start delaying pushes..
Other than that the only issue could be the GCM service and/also your phone. Make sure that your phone's radio is open at all times and you are using a stock OS. See if the problem is still happening in couple of hours so (in case there's a problem at the GCM servers)

Categories

Resources