Cannot mark as impressed more than one message almost same time
See original GitHub issue- Android Studio version: Arctic Fox 2020.3.1 Patch 4
- Firebase Component: InAppMessage
- Component version: 19.1.5
Steps to reproduce:
Have a custom Display component for InAppMessage, i.e.:
FirebaseInAppMessaging.getInstance().setMessageDisplayComponent(new MyFirebaseMessaging());
Relevant Code:
My custom display component has a HashMap
to handle multiple messages displaying on screen. Like 2 cards embedded on layout.
private final HashMap<String, HashMap> InAppMessages = new HashMap<>();
Every time we receive a message we do something like:
@Override
public void displayMessage(@NonNull InAppMessage inAppMessage, @NonNull FirebaseInAppMessagingDisplayCallbacks callbacks) {
try {
String campaignId = inAppMessage.getCampaignMetadata().getCampaignId();
// Here we build a object that represents the received message
HashMap<String, Object> inAppMessageObject = new HashMap<String, Object>();
inAppMessageObject.put("message", inAppMessage);
inAppMessageObject.put("callbacks", callbacks);
// Then we put on HashMap this object to be called later
this.InAppMessages.put(campaignId, inAppMessageObject);
} catch (Exception e) {
Log.e("FIAM: Error", e.toString());
}
}
The problem
Some times, more than one event is triggered each one with a message assigned:
FirebaseInAppMessaging.getInstance().triggerEvent("main_screen_opened");
FirebaseInAppMessaging.getInstance().triggerEvent("another_main_screen_opened");
But when we try to mark as impressed only one message are marked. We use something like this to handle multiple messages and mark each as impressed:
public void markAsImpressionDetected(String campaignId) {
try {
// We recover from HashMap the message callbacks
FirebaseInAppMessagingDisplayCallbacks callbacks = (FirebaseInAppMessagingDisplayCallbacks) this.InAppMessages.get(campaignId).get("callbacks");
// And call
callbacks.impressionDetected();
} catch(Exception e) {
Log.e("FIAM: Error", e.toString());
}
}
With milliseconds between each call. But always only one of 2 or more messages are marked as impressed. And no error was throw
Issue Analytics
- State:
- Created a year ago
- Comments:11 (8 by maintainers)
Top Results From Across the Web
Re: New to Meraki-Go - So far not impressed - The Meraki Community
I have been a HUGE fan of Cisco and Meraki for a very long time. I was sold on a Ubiquiti setup, and...
Read more >Improve Google Translate
Fill-in-the-blank or multiple-choice. We show you a phrase, you type in a translation. Or if you'd rather just click or tap, we'll show...
Read more >John Hinckley Jr. - Wikipedia
Hinckley was reportedly seeking fame to impress actress Jodie Foster, with whom he had an obsessive fixation. He was found not guilty by...
Read more >why defi is the future
They cannot conceive of innocence. Neither can children. But civilization has at last created men who behave innocently. For the first time they...
Read more >designation defi - James Hardie
The deck crew relayed the message to the crane operator, and the Kevlar ... if more cutting was needed when there was an...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Thanks for the explaining, @igorjacauna. I was able to reproduce the same behavior. I’ll notify an engineer and see what we can do here.
Hi all, seems to me that the fix for this has been merged. That said, I’ll close this issue now. Feel free to reopen if the issue is still present.