question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Question] Push notification messages are not displayed in the closed/background app on launch

See original GitHub issue

[REQUIRED] Please fill in the following fields:

  • Unity editor version: 2020.3.10
  • Firebase Unity SDK version: 8.1.0
  • Source you installed the SDK: unitypackage
  • Problematic Firebase Component: Messaging
  • Other Firebase Components in use: Analytics, Deepliinks, Crashlytics,
  • Additional SDKs you are using: Facebook, IronSource
  • Platform you are using the Unity editor on Windows
  • Platform you are targeting: Android
  • Scripting Runtime: IL2CPP

[REQUIRED] Please describe the question here:

Push notification messages are not received in the app if the app is either closed or is in the background. The foreground app receives messages OK.

queued message 0:1628115171791201%bfe3fe3bbfe3fe3b
Firebase.AppUtilPINVOKE:PollCallbacks()
Firebase.AppUtil:PollCallbacks()
Firebase.Platform.FirebaseHandler:Update()

and

2021-08-10 00:14:38.207 23350-23465/com.threed_view.FluentWorldsDev E/Unity: Couldn't parse the message: Object reference not set to an instance of an object.
    VIEW.VCT.Common.VCTLog:Error(String, String)
    VIEW.VCT.Common.VCTLog:CatchLogs(String, String, LogType)
    UnityEngine.LogCallback:Invoke(String, String, LogType)
    VIEW.VCT.Common.MessagingService:OnMessageReceived(Object, MessageReceivedEventArgs)
    System.EventHandler`1:Invoke(Object, TEventArgs)
    Firebase.Messaging.<MessageReceivedDelegateMethod>c__AnonStorey0:<>m__0()
    System.Func`1:Invoke()
    Firebase.ExceptionAggregator:Wrap(Func`1, T)
    Firebase.AppUtilPINVOKE:PollCallbacks()
    Firebase.AppUtil:PollCallbacks()
    Firebase.Platform.FirebaseHandler:Update()

2021-08-10 00:01:16.109 20990-21989/com.threed_view.FluentWorldsDev W/FirebaseMessaging: Missing Default Notification Channel metadata in AndroidManifest. Default value will be used.

So I guess I somehow missing on queued message handling when app is launched?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:15 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
chkuang-gcommented, Sep 15, 2021

@equizo

I tried to reproduce it with the following configuration, but I can get the OnMessageReceived event properly after I subscribe a topic, kill the app, send the message through Firebase console and click on the notification.

  • Built with Unity 2020.3.18f1
  • FCM Unity testapp
  • Firebase Unity SDK 8.1.0
  • Built Android apk and deployed to a physical Pixel device (my phone 😒)

Here is what I did after the app was deployed:

  1. Launched the app for the first time.
  2. Picked a topic and click on Subscribe button.
  3. Send a message from Firebase console and confirm the message is received when the app is in the foreground.
  4. Killed the app.
  5. Sent another message from Firebase console. Confirmed the notification is received on the device.
  6. Clicked on the notification, confirmed the message is received in Unity app.

Here is a screenshot of the app for the second launch. Screenshot_20210914-185520

I would be great if you can help us to diagnose the issue with the following steps.

  1. Try to run the steps I described above and see if you reproduce the issue using FCM quickstart,
  2. Either with the quickstart or your app, try to see if there is any abnormal logs using adb logcat when the issue occurs.
  3. This issue #1088 sometimes can prevent the async FCM APIs from finishing with some configurations. This only occurs from 8.0.0. Could you try to downgrade to 7.2.0 and see if the issue still occurs? Or FWIW, upgrade to 8.2.0 and see if anything changed. You should find all the .unitypackage you need from this page (FCM, Crashlytics and Analytics)

Appreciate it. Shawn

0reactions
google-oss-botcommented, Sep 28, 2021

Since there haven’t been any recent updates here, I am going to close this issue.

@equizo if you’re still experiencing this problem and want to continue the discussion just leave a comment here and we are happy to re-open this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Push notification not displayed when app is closed in android
I am using Googles firebase for the notifications. The API 26 device does not receive push notifications unless I open the app first....
Read more >
Push Notification not showing up when app is closed
When i close the app (for example swipe it away from recents) then the Push Notifications will not be shown. The Device receives...
Read more >
Push notification in Background works fine when App runs ...
Push notification in Background works fine when App runs by Xcode, but does not work when App runs by itself.
Read more >
Notifications Not Shown - Mobile Push
The following are reasons why notifications may show as "Delivered" on the OneSignal dashboard or API, but are not visible on your device....
Read more >
Push Notification Not Shown when App is OPEN - Android
I am using full push notifications in Ionic with the phonegap-plugin-push. Testing on Android when my app is closed/background my notification ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found