1

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!

AL.
  • 36,815
  • 10
  • 142
  • 281
maohieng
  • 1,646
  • 1
  • 19
  • 26
  • Have you tried using a different network (wifi) and see if it's the same case? 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. Does that make sense? Anyways, your English is fine. Cheers! – AL. Dec 09 '16 at 07:22
  • 1
    Thanks, @AL. I have tested as you said, and it works now on the device, but not emulator (I wait, then turned on & off to get notification). Whatever when this works on real device real timely, I have no worry anymore. Thanks again. :) – maohieng Dec 11 '16 at 05:07
  • Glad to see it's working fine. Guess it was just a setting or behavior on the wifi side. Or something with the emulator. Please feel free to put in an answer for your post then mark it as accepted. Cheers! – AL. Dec 11 '16 at 09:14

2 Answers2

1

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.

maohieng
  • 1,646
  • 1
  • 19
  • 26
0

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).

Community
  • 1
  • 1
Reaz Murshed
  • 23,691
  • 13
  • 78
  • 98