Repository: firebase/firebase-android-sdk

Issue #1410: How to configure In-App Messaging to show the message after splash screen
Created: 2020-04-01T15:27:25Z
[REQUIRED] Step 2: Describe your environment

Android Studio version: 3.6.1
Firebase Component: In-App Messaging
Component version: firebase-inappmessaging-display-ktx:19.0.4

[REQUIRED] Step 3: Describe the problem
I can successfully receive a message on my splash activity, but in reality I need to show in a later activity, so in firebase in the Scheduling section I removed all the events and added a new one "login_activity_opened", which I trigger when the login activity is opened.
But the event is always shows when I open the app, in the splash activity screen.
Steps to reproduce:
as shown in the description
Relevant Code:
How I trigger the event:
FirebaseAnalytics.getInstance(context).logEvent("login_activity_opened", trackEvent.getEventValues()?.toBundle())
FirebaseInAppMessaging.getInstance().triggerEvent("login_activity_opened")

Duplicate issue #1324: In-App Messaging is not displayed on the intended Activity
Created: 2020-03-07T15:58:37Z
[READ] Step 1: Are you in the right place?
👀
[REQUIRED] Step 2: Describe your environment

Android Studio version: 3.6.1
Firebase Component: In-App Messaging
Component version: firebase-inappmessaging-display:19.0.3, firebase-messaging:20.1.1

[REQUIRED] Step 3: Describe the problem
My Application has 2 Activities.
One is LaunchActivity (it has android.intent.category.LAUNCHER intent-filter),other is MainActivity.
I expect a In-App Messaging is appear on MainActivity, but not.
I use FirebaseInAppMessaging.getInstance().setMessagesSuppressed(...) but, message is disappear soon.
see : #1299
Steps to reproduce:
see below code.
Relevant Code:
class LaunchActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_launch)
        FirebaseInAppMessaging.getInstance().setMessagesSuppressed(true)
        openMainActivity()
    }

    private fun openMainActivity() {
        val intent = Intent(this, MainActivity::class.java)
        intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK or Intent.FLAG_ACTIVITY_NEW_TASK)
        startActivity(intent)
    }

    override fun onResume() {
        super.onResume()
        fun createText(text: String): Text =
            Text.builder().setText(text).setHexColor("#000000").build()

        val campaignMetadata = CampaignMetadata("test_campaign", "name", true)
        val title = createText("messageTitle")
        val body = createText("bodyText")
        val message: ModalMessage = ModalMessage.builder()
            .setBackgroundHexColor("#ffffff")
            .setTitle(title)
            .setBody(body)
            .build(campaignMetadata, null)

        FirebaseInAppMessagingDisplay.getInstance().testMessage(this, message, null)
    }
}
class MainActivity : AppCompatActivity() {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        FirebaseInAppMessaging.getInstance().setMessagesSuppressed(false)
    }
}
I found that, when LaunchActivity is destroyed, In-App message is disappear.
So, I use this workaroud, but I don't think it's a good way.
Please fix the problem that the message disappears when the Activity which is not the foreground is destroyed.

Closing comment (2020-05-28T05:47:50Z): Duplicate of #1410
Fixed in version 19.0.7 of  firebase-inappmessaging-display