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.

Override behavior of In-App message

See original GitHub issue

[REQUIRED] Step 2: Describe your environment

  • Android Studio version: Arctic Fox 2020.3.1 Patch 3
  • Firebase Component: In-App Messaging
  • Component version: com.google.firebase:firebase-bom:28.3.0

[REQUIRED] Step 3: Describe the problem

Steps to reproduce:

I created a Firebase In-App messaging campaign from console and I used addClickListener() to override behavior of primary button action. When I receive the in-app message and click primary button, my custom listener is invoked correctly but the Firebase SDK opens the link from campaign.

I need to attach dynamic information to the link configured in the Firebase console and then open the composed link.

The problem is in this line because when I override the click behavior, the SDK invokes launchUriIntent(activity, Uri.parse(action.getActionUrl())); anyway

Relevant Code:

I think that the fix can be something like that:

@Override
public void onClick(View v) {
    if (callbacks != null) {
        Logging.logi("Calling callback for click action");
        callbacks.messageClicked(action);
    } else {    <====== THIS ELSE
        launchUriIntent(activity, Uri.parse(action.getActionUrl()));
    }
   
    notifyFiamClick();
    // Ensure that we remove the displayed FIAM, and ensure that on re-load, the message
    // isn't re-displayed
    removeDisplayedFiam(activity);
    inAppMessage = null;
    callbacks = null;
}

In this way, the SDK delegates the behavior to the custom listener

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:6
  • Comments:9 (4 by maintainers)

github_iconTop GitHub Comments

4reactions
argzdevcommented, May 13, 2022

Hi @garispe, thank you for submitting a PR for this! I was able to test this and it works nicely.

I’m not sure if this is an intended behavior or an actual bug, I’ll notify an engineer to see if we can get your PR approved or if there are changes needs to be done.

2reactions
eldhosembabucommented, May 16, 2022

Hi @garispe , Thanks for reaching out on this and for the PR.

The event listeners mentioned here are for the purpose of tracking the user interactions and not for overriding them. For example when the user interacts with an inapp message and is getting navigated to a web url, if the developer wants to track the navigation, then they can use these listeners. Sorry for the mis understanding here.

But however we understand the developers need for having custom handling of inapp message and so we will consider this in our upcoming features ie. to support inapp message customization and handling.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Modify behavior of Firebase In-App Messaging ... - Google
Once you set automaticDataCollectionEnabled to YES , the value persists through app restarts, overriding the value in your Info.plist . If you'd like...
Read more >
Modify behavior of Firebase In-App Messaging messages
Once you set a data collection preference manually, the value persists through app restarts, overriding the value in your Info.plist or AndroidManifest.xml ....
Read more >
In-App Messages on iOS - Iterable Support Center
# Overriding whether to show or skip a particular in-app message ... An incoming in-app message triggers a call to the onNew method...
Read more >
In-App Messaging: Proven Examples and Best Practices
You should study the behaviors of your users and accordingly decide when would be the best moment for you to send those in-app...
Read more >
In-app message content - Airship Docs
Appearance and behavior · Animation — In-app messages animate into the user's screen. · Colors — Notification colors can be specified in your...
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