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

messaging/testapp not working

Open nmtoan91 opened this issue 1 year ago • 3 comments

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2022.3.18
  • Firebase Unity SDK version: 11.6
  • Source you installed the SDK: .unitypackage
  • Problematic Firebase Component: Messaging
  • Other Firebase Components in use: Analytics
  • Additional SDKs you are using: No
  • Platform you are using the Unity editor on: Windows
  • Platform you are targeting: Android
  • Scripting Runtime: Mono and IL2CPP

[REQUIRED] Please describe the issue here:

Problem: The app can receive the message as I see the log in the demo UI but there is no notification shown on my phone. I followed the steps correctly in the messaging/testapp. I even enable the notification permission manually for the app.

nmtoan91 avatar Jan 30 '24 14:01 nmtoan91

This issue does not seem to follow the issue template. Make sure you provide all the required information.

google-oss-bot avatar Jan 30 '24 14:01 google-oss-bot

The same issue occurred with the newly created project,

I had just imported the .unitypackage of Cloud Messaging, and it's stopped creating builds.

Parth10277 avatar Feb 20 '24 11:02 Parth10277

Hey nmtoan91. From your description, it seems to me that the app is receiving the notification message in the logs when your phone is on the foreground. This is an intended behavior. Keep in mind that the behavior of the Firebase messages differentiate when the app is in background or foreground. In our documentations:

  1. When in the background, apps receive the notification payload in the notification tray, and only handle the data payload when the user taps on the notification.
  2. When in the foreground, your app receives a message object with both payloads available.

If you notice in #2, the app will likely receive a message object but will not a notification pop up. If you'd like to receive a notification even if the app is on the foreground, you'll have to add your code logic to display notifications in the OnMessageReceived event. You may check out the documentations how to get started here.

argzdev avatar May 07 '24 12:05 argzdev