Notification not showing

I’m implementing Defold Push notification for Android, however when testing I see that the listener got messages (payload is the data) but the notification popup is not showing. What did I miss to have it showing?

Here is my curl command for testing:

./curl  -X POST  -H "Content-type: application/json"  -H 'Authorization: key="[SERVER_KEY]"' -d '{\"registration_ids\":[\"[MY_TOKEN]\"],\"notification\":{\"title\":\"Kỳ Hoàng\",\"body\":\"Hello\"},\"data\":{\"alert\":\"Alert!\",\"title\":\"Ky Hoang\",\"body\":\"Test\"} }' https://fcm.googleapis.com/fcm/send

If I recall correctly the notification will only show if the game is not in the foreground. If the game is running you’ll get the callback but no notification. Could this be the case?

1 Like

I checked both cases, when app opening and when app not running. There were no notifications in both.

I recently known a reason. There are configs in game.project

[android]
push_field_title = title
push_field_text = body

It seems having these configs helps. But there’s another strange thing, after a few notifications showed, there’s no more appearing… though I used the same command.

Could it be something which the OS or the GCP backend throttles?

I don’t think so, I just tested a few and when the app in foreground I can see the messages deliveried (via listener), the send result is also showing it succeeded.

I think for some reasons the notification is just not showing, or the background service dropped it.

I have an app (not built by Defold) and notifications always showing when I do testing. But as I’m not familiar with native code so I have no ideas what is differrent

Somehows I just reinstalled the app then it’s working again.

There’s another reason for not showing notifications I just found that is having notification field as in my curl command above will make it not showing

After taking a look at the extension code, I see there are something need to be considered:

For the notification not showing issue, I think I got the way to avoid it. We could close this thread for now :slight_smile:

Are you referring to this?

There is an extension that you can use for this:

Yes, that is. However, after having closer look, I see it’s on a purpose. Having unstandard notification message will help to manually show a custom notification
firebase-android-sdk/firebase-messaging/src/main/java/com/google/firebase/messaging/FirebaseMessagingService.java at master · firebase/firebase-android-sdk (github.com)

Thanks, I’ll try that once I do testing on Android 13+ devices.

1 Like