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.

Message is not showing!

See original GitHub issue

Hi, I have a similar problem issue 977 with two activities. Message is not showing on second activity after first has destroyed.

I suppose, there is a problem with calling FirebaseInAppMessaging.clearDisplayListener() in FirebaseInAppMessagingDisplay.onActivityDestroyed without checking which activity has destroyed (current or previous). As a result, the app can skip messages.

I use firebase-inappmessaging-display:19.0.2

Reproducible example here

Steps:

  1. Get example app’s Instance ID
  2. Close example app
  3. send test in-app message from firebase console
  4. open app (open FirstActivity)
  5. FirstActivity open SecondActivity
  6. FirstActivity has finished.
  7. SecondActivity still opened.
  8. The message was received but not showing.

Logcat report:

2019-12-24 13:01:07.241 17432-17432/com.master8.experimentalproject D/FIAM.Display: Created activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.292 17432-17432/com.master8.experimentalproject D/FIAM.Display: Started activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.292 17432-17432/com.master8.experimentalproject I/FIAM.Headless: Setting display event listener
2019-12-24 13:01:07.295 17432-17432/com.master8.experimentalproject I/FIAM.Headless: went foreground
2019-12-24 13:01:07.295 17432-17432/com.master8.experimentalproject D/FIAM.Headless: Event Triggered: ON_FOREGROUND
2019-12-24 13:01:07.295 17432-17432/com.master8.experimentalproject D/FIAM.Display: Resumed activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.297 17432-17533/com.master8.experimentalproject I/FIAM.Headless: Forcing fetch from service rather than cache. Test Device: true | App Fresh Install: true
2019-12-24 13:01:07.297 17432-17533/com.master8.experimentalproject I/FIAM.Headless: Recoverable exception while reading cache: /data/user/0/com.master8.experimentalproject/files/fiam_impressions_store_file (No such file or directory)
2019-12-24 13:01:07.300 17432-17533/com.master8.experimentalproject I/FIAM.Headless: Fetching campaigns from service.
2019-12-24 13:01:07.322 17432-17432/com.master8.experimentalproject I/FIAM.Headless: Removing display event listener
2019-12-24 13:01:07.322 17432-17432/com.master8.experimentalproject D/FIAM.Display: Pausing activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.352 17432-17432/com.master8.experimentalproject D/FIAM.Display: Created activity: com.master8.experimentalproject.SecondActivity
2019-12-24 13:01:07.389 17432-17432/com.master8.experimentalproject D/FIAM.Display: Started activity: com.master8.experimentalproject.SecondActivity
2019-12-24 13:01:07.389 17432-17432/com.master8.experimentalproject I/FIAM.Headless: Setting display event listener
2019-12-24 13:01:07.392 17432-17432/com.master8.experimentalproject D/FIAM.Display: Resumed activity: com.master8.experimentalproject.SecondActivity
2019-12-24 13:01:07.524 17432-17432/com.master8.experimentalproject D/FIAM.Display: Stopped activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.526 17432-17432/com.master8.experimentalproject I/FIAM.Headless: Removing display event listener
2019-12-24 13:01:07.526 17432-17432/com.master8.experimentalproject D/FIAM.Display: Destroyed activity: com.master8.experimentalproject.FirstActivity
2019-12-24 13:01:07.681 17432-17533/com.master8.experimentalproject I/FIAM.Headless: Successfully fetched 1 messages from backend
2019-12-24 13:01:07.682 17432-17533/com.master8.experimentalproject D/FIAM.Headless: Updating contextual triggers for the following analytics events: []
2019-12-24 13:01:07.690 17432-17533/com.master8.experimentalproject D/FIAM.Headless: Decoding message: # com.google.firebase.inappmessaging.MessagesProto$Content@533ba749
    banner {
      background_hex_color: "#3ca9ff"
      body {
        hex_color: "#ffffff"
        text: "\320\242\320\265\320\272\321\201\321\202 \321\201\320\276\320\276\320\261\321\211\320\265\320\275\320\270\321\217"
      }
      title {
        hex_color: "#ffffff"
        text: "\320\227\320\260\320\263\320\276\320\273\320\276\320\262\320\276\320\272"
      }
    }

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:3
  • Comments:25 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
JasonAHeroncommented, Apr 17, 2020

Hey folks, we are aware of this and I am currently working on a solution. Yeah the issue is exactly as you folks describe, the way we hook into the activity lifecycle doesn’t work well for apps with splash screens. The problem is that not doing this has resulted in callbacks referencing dead activities and crashing apps. I am going to be prioritizing investigating this issue this week.

3reactions
hamenocommented, Feb 20, 2020

The real solution would be to either:

  1. re-display messages that have not been acknowledged/manually closed by the user
  2. allow developers to mark activities as “unusable” and trigger messages in the next activity, common use-case would be a login or splash activity. https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android#temporarily_disable_in-app_messages cannot be used for that, as it will not trigger events at a later stage, right?
  3. let the inappmessage dialog be their own activity, then it should not matter anyway
Read more comments on GitHub >

github_iconTop Results From Across the Web

Fix problems sending, receiving or connecting to Messages
If you can't send or receive messages, or have trouble connecting to Messages on web, try the following suggestions below. Fix problems sending...
Read more >
Is your messaging app not working? Try these fixes
Is your messaging app not working? Try these fixes · Outages and reception · Is Airplane mode on? · Restart the phone to...
Read more >
Is iMessage not working? Here's how to fix it on your iPhone ...
Check you're set to send and receive iMessages by going to Settings > Messages and checking that iMessage is turned on. If when...
Read more >
How to Fix It When You're Not Receiving Texts on Android
Text messaging has three components: the devices, the app, and the network. These components have multiple points of failure. The device may not...
Read more >
6 Ways to Fix “Android Messaging App Not Working” Issue
How to Fix “ Message App Not Working” on Android · Tip 1. Restart Your Android Phone · Tip 2. Force Stop Message...
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