I am trying Model layout of Firebase in-app messaging. On model I have added one button. and for that button action, I have provided the firebase dynamic link. So when the user is clicking on button dynamic link is getting a trigger. and it's first opening the browser and after that, it's again coming to application. This interaction is not looking more natural. I want to open the new page on click of the action button. But on click of action button first browser is getting open. How to solve this issue?
2 Answers
You can implement FirebaseInAppMessagingClickListener in your mainActivity and initialize in onCreate() method using FirebaseInAppMessaging.getInstance().addClickListener(MainActivity.this); for more details please click below link-
https://firebase.google.com/docs/in-app-messaging/modify-message-behavior?platform=android

- 1,189
- 1
- 8
- 19
Simplest way to achieve this would be to extend your MainActivity
with FirebaseInAppMessagingClickListener
if you know that the In-App Message will be triggered there & then create & Intent & open another activity.
Add the messageClicked function to your class:
@Override
public void messageClicked(InAppMessage inAppMessage, Action action) {
// Determine which URL the user clicked
String url = action.getActionUrl();
// Get general information about the campaign
CampaignMetadata metadata = inAppMessage.getCampaignMetadata();
// Trigger an Intent to another class
}
And register it (in your MainActivity) too:
FirebaseInAppMessaging.getInstance().addClickListener(this);
PS: In the case that you schedule your In-App Message to be triggered on a certain event, implement this code in the activity there.

- 955
- 2
- 14
- 27