So I followed Parse's guide on setting up push notifications yesterday. I left the client channel to "" for Broadcast. And when I tried to send notifications, My phone didn't receive any. After trying to trouble shoot for a while I gave up and went to bed.
Then I was waken up by my phone buzzing at 6 in the morning. I look at it and it's the dozen push notifications I sent like 8 hours earlier. (To be clear when I sent them I set the all to now. I didn't schedule them). So when I try to send them today it didn't work. I tried switching the channel and it worked. I sent a push notification and my phone received it instantly. After that I went to eat, came back and tried to test some things out and my phone doesn't receive them anymore.
Has anyone ever noticed behavior like this or know what the problem might be. Parse tells me that they send just fine and I don't know if it's an issue with my code because it CAN receive them.
Related
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.
With a fresh install app on my Samsung Note 5 device and also on my emulator, some notifications was sent via the Firebase console are received properly on those 2 devices.
But after a day, my emulator was reopened, my phone was reconnected to the Wifi, I started creating some few notification messages on Firebase console again, but those devices did not receive any message from Firebase.
I turned off and turned on my phone's Wifi, then the phone received those notifications. I turned on and turned off plane mode on my emulator, then the emulator received those notifications. Is there something wrong with my app? Or with Firebase? (I already use WAKE_LOCK permission). Any suggestion?
Thanks!
It seems to work fine now after I changed my device's Wifi connection.
From #AL's comment:
There might be a chance that the Android device is connected to the
Wifi, but your Wifi needs something like a refresh for the internet
connection to work again, which is the same case for the devices
connected to it.
I still not sure why, but his comment make this works.
Great to know that, #AL gave a hint of the problem and you got it working too. I'm here for putting some of my thoughts here regarding your issue.
As you've worked with push notification already, I think you know pretty much about how this works actually. If you want a short brief, you might take a look at this answer.
Now, you already have known, you need to get a push registration ID from FCM when your application starts. This push registration ID, is the unique ID by which FCM knows when and how to send you a push notification. This push registration ID doesn't change every time you launch your application, but yes, it changes some times. When your push registration ID has been changed, but you couldn't get your new push registration ID from FCM, the push notification won't work properly in that time. This is usually a network issue though, but don't panic if that happens.
Another thing I need to point out is, push notification is not always guaranteed to be received in your device/devices. So if you're performing some action when a push notification is received in your application, you might need to make the action fail safe too (e.g. you might consider polling after a certain time if no push is received).
I have setup Push notifications in my Worklight 6.3 hybrid app which was working fine in my Android device until few days back. I didn't make any changes to the app after that. Now when I try to send notification, I get the result as '{"isSuccessful":true,"result": "Notification sent to user :: admin"}'.
Neither do I see notifications on my device, nor I see any error messages. I also get the 'onSuccess' callback called when WL.Client.Push.subscribe API is executed
From your description its seems like the message is sent to GCM and the
question we need to ask is why it's not arriving the device.
1)Can you please reinstall the application and then try to send push notification?
If it will work you may have a problem with the device subscription.
2)can you paste here the logcat - maybe we can find something there...
3)Did you try to receive the push when the phone is on WiFi?
If possible please try to check it on a different network.
Sometimes GCM is slow and you might get a notification after about 5 to 10 mins.
if we get isSuccessful":true,"result": "Notification sent to user :: admin
then from worklight end we have done everything right and GCM has also accepted the notification to be sent.
I will know more once you will upload the additional information
I have an app based on Google Cloud Messaging and it was working well. Now (today) all of a sudden it started having a problem we've never seen before. For each message sent between devices, the receiving device will get it twice. The first will arrive almost instantly (within less than 3 seconds of sending). The second arrives a few minutes later. There are two devices in the test, the problem is the same whichever one is the sender/receiver. So if a device sends a few message to the other, the other will get them pretty much instantly--but then at a later time, it will receive a barrage of messages which are the second copies of the messages it has received.
I have put in breakpoints to make sure that the sending device wasn't the culprit: the message was sent exactly once (i.e. the web service for sending was called exactly once--and the code for the backend, which runs on Google App Engine, hasn't changed for ages.) However, the message somehow gets delivered to the receiving device twice. By using breakpoints I also made sure our own code on receiving side isn't responsible: it is verified that GCMIntentService::onMessage() indeed gets invoked twice for each sent message.
We also made sure the registration id in our database is the latest. At this point I'm stumped and need ideas to make any further progress. So any ideas?
https://groups.google.com/forum/#!topic/android-gcm/EHZUTEJMeyw
Check the official GCM thread above. Everyone is experiencing this issue. Google's fault!
We also have the same problem, and we are sure we don't send the message twice.
It could be an issue related to what's explained here about "Canonical IDs": http://developer.android.com/google/gcm/adv.html
[...] However, if a bug in the application triggers multiple registrations for the same device, it can be hard to reconcile state and you might end up with duplicate messages.
Same problem here. We have many apps integraded with MyMalcom and Urban Airship and all of them are getting pushes twice since Monday. We have checked also the canonicalId changes as suggested by Ferran, but the delivered to GCM messages are ok (no cannonical Id changes).
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)