0

I want to open a specific activity on-click of buttons in firebase in-app messaging, by default it is redirecting to the browser. I want to open relevant activity within my app itself if user clicks on action button. please suggest me how can I disable browser redirection.

Frank van Puffelen
  • 565,676
  • 79
  • 828
  • 807
Charmi
  • 21
  • 1
  • 5

1 Answers1

0

Assuming again that you want to track which link a user clicked on a Card-style message, define a class that implements the messageClicked method per the FirebaseInAppMessagingClickListener interface, thereby providing you access to the in-app messaging Action object, which in turn exposes the URL in the link clicked by the user.

First, implement a click listener:

public class MyClickListener implements FirebaseInAppMessagingClickListener {

    @Override
    public void messageClicked(InAppMessage inAppMessage, Action action) {
        // Determine which URL the user clicked
        String url = action.getActionUrl(); // you can open the relevant screen.

        // Get general information about the campaign
        CampaignMetadata metadata = inAppMessage.getCampaignMetadata();

        // ...
    }

}
Arda Kazancı
  • 8,341
  • 4
  • 28
  • 50
  • I have implemented this interface callback but still it is redirecting to browser app on click of action button. basically it is doing 2 things simultaneously - opening activity and also redirecting user to browser. – Charmi Aug 05 '22 at 12:07
  • you can catch the relevant url and use intent – Arda Kazancı Aug 05 '22 at 12:09
  • now I am able to open specific activity but the issue is I am unable to receive custom Key/value pairs data with in-app message using. I am using below lines of code to receive it - Map dataBundle = inAppMessage.getData(); Log.d("kk", "messageClicked: "+dataBundle); – Charmi Aug 12 '22 at 09:15