firebase / firebase-android-sdk

Firebase Android SDK
https://firebase.google.com
Apache License 2.0
2.28k stars 578 forks source link

Firebase InAppMessaging onClickListener still not called #2184

Open jonathanfontaine opened 3 years ago

jonathanfontaine commented 3 years ago

What feature would you like to see?

An issue was already filled about this subject here, but I'm still having trouble.

In the Firebase Console, when I click on the "Test Button" to test my In-app Messaging campaign, the message appears in my app. Good. BUT THEN in my app, when I click on the message default "OK" button, the messageClicked callback is never called.

@JasonAHeron It was supposed to be fixed in a coming release as you said here, any news about that ?

I have the latest version of inappmessaging and inappmessaging-display dependencies in my build.gradle :

implementation platform('com.google.firebase:firebase-bom:26.1.0')
implementation 'com.google.firebase:firebase-core'
implementation 'com.google.firebase:firebase-inappmessaging'
implementation 'com.google.firebase:firebase-inappmessaging-display'
implementation 'com.google.firebase:firebase-analytics'

My HomeActivity onCreate method looks like that :

override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)
    FirebaseInAppMessaging.getInstance().addClickListener(object : FirebaseInAppMessagingClickListener {
        override fun messageClicked(inAppMessage: InAppMessage, action: Action) {
            val url = action.getActionUrl()
            val metadata = inAppMessage.getCampaignMetadata()
            val dataBundle = inAppMessage.data
        }
    })
}

How would you use it?

That would be really useful when setting up the in app messaging for the first time. In my case, I need to check the key/value data passed in the message.

google-oss-bot commented 3 years ago

I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.

manishjoshi1111-zz commented 3 years ago

I observed that when we define an action url for the action button the messageClicked() is called without an issue. But when we don't define an action url and select the "Use dismiss as the action" checkbox, then the messageClicked() is not called. I need to be able to navigate the user to a certain screen in the app on clicking the action button. I cannot use deep link as the UX will be terrible if the app restarts on a button click for a simple navigation process. Any suggestions would be helpful.

albertB4work commented 6 months ago

It would be grateful also to implement that method works also in test messages. I read in the related post that it was a feature that was pending to develop