quickstart-android icon indicating copy to clipboard operation
quickstart-android copied to clipboard

onMessageReceived isn't always called

Open stkq opened this issue 7 years ago • 8 comments

  • Android device: Multiple devices
  • Android OS version: Multiple OS versions
  • Google Play Services version:
  • Firebase/Play Services SDK version: 11.4.2

The onMessageReceived method is only called for about 2/3 of the users. It's not because it's in the background because it's a data payload sent from Microsoft Azure, and the method is called for me and the notification displayed when I have the app closed. I know they're reaching the device because I checked the Play Console and they're marked as 'Acknowledged'.

Steps to reproduce:

  1. Follow the quickstart example and log the onMessageReceived call
  2. Send a message with a data payload
  3. See how many of your push notifications are logged

Observed Results:

Only about 2/3 of the notifications end up with a call to onMessageReceived.

Expected Results:

I expected all of the notifications to reach onMessageReceived.

Relevant Code:

 <service
 android:name=".push.MyFirebaseMessagingService">
     <intent-filter>
         <action android:name="com.google.firebase.MESSAGING_EVENT"/>
     </intent-filter>
 </service>
public class MyFirebaseMessagingService extends FirebaseMessagingService {

...
@Override
public void onMessageReceived(RemoteMessage remoteMessage) {
...
}

stkq avatar Nov 08 '17 11:11 stkq

Hi @stkq couple questions:

  • Are you seeing 3 Acks in the Android dev console but only getting onMessageReceived call twice?
  • Is this happening on a particular device or across multiple devices?

kroikie avatar Nov 10 '17 19:11 kroikie

  1. When I say 2/3 I mean 2/3 of thousands of notifications, but yes, for about 1/3 of those notifications, the console says 'Acknowledged' but the onMessageReceived method is not called. For the other 2/3, the console says Acknowledged and the onMessageReceived is called.
  2. It's multiple devices but when it happens on one device it usually happens multiple times on that device. There's no pattern when it comes to type of device though.

stkq avatar Nov 13 '17 11:11 stkq

We are having the same issue, and it is a major problem. Any forecast on when is it going to be resolved? Any workaround?

amitportish avatar Dec 16 '17 20:12 amitportish

We have same issues with our test devices. Seems like some device manufacturers don't allow notifications in some situations, We are investigating also Take a loook on manufacturers-interfere-with-reliable-notifications

mowbell avatar Apr 20 '18 19:04 mowbell

#822

KORuL avatar Jul 14 '19 18:07 KORuL

Hi. We have same issue even in release builds. According to FCM diagnostic tool we found out that we received all messages but some of them weren't broadcasted to our app. Any thoughts how to deal with it? To be clear:

  1. We send high priority push notifications
  2. We use legacy http protocol
  3. Push-notifications work fine until device is in doze mode and app is in standby mode. At least this is the only way we as developers were able to reproduce this issue.
  4. This issue reproduced even if device connected to the charger. How is it possible?
  5. Indeed it is rare case but it is very important for us because we have calling app.

memfis19 avatar Oct 28 '20 10:10 memfis19

Im not a bot I just don't talk

willmastered avatar Oct 29 '20 08:10 willmastered

I am also working on a calling app, and I am still dealing with the same issue. For me there are random periods of a minute or two where no notifications arrive, and then it works again. For a calling app that is not fine. Did you ever find a work around for this problem @memfis19 ?

IvanSimovic avatar Sep 05 '22 13:09 IvanSimovic