1

I tried to display In-App Messaging but it didn't show up with TWA. In-App Messaging works without any problems with normal Activity.

I use https://github.com/GoogleChrome/android-browser-helper/tree/main/demos/twa-basic to test TWA.

My application is correctly configured with Firebase. I created a campaign.enter image description here

My logs after publishing the campaign: ``

I closed my application and then launched it and I didn't see In-App Messaging.

I tested another application with a standard Activity and there was no problem displaying In-App Messaging.

enter image description here

tesst
  • 11
  • 2
  • Hey @tesst! Welcome to SO! Check out https://stackoverflow.com/help/how-to-ask for help writing a question that helps us help you! Some pointers: include code, include logs, and just about all the details you can. – Ars_Codicis Feb 03 '23 at 20:02
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Feb 04 '23 at 03:17

1 Answers1

0

I took a lot of time today to answer this question for myself.

In my opinion TWA can't work with In-App Messaging. I am not an Android programmer and I could be wrong.

This is my test Activity:

public class MainActivity extends AppCompatActivity {

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);
    FirebaseInAppMessaging.getInstance().setMessagesSuppressed(true);
}

public void onClick(View view) {
    CampaignMetadata campaignMetadata = new CampaignMetadata("test_campaign", "name", true);
    Text title =  Text.builder().setText("test").setHexColor("#000000").build();
    Text body =  Text.builder().setText("test").setHexColor("#000000").build();

    ModalMessage message = ModalMessage.builder()
            .setBackgroundHexColor("#ffffff")
            .setTitle(title)
            .setBody(body)
            .build(campaignMetadata, null);

    FirebaseInAppMessagingDisplay.getInstance().testMessage(this, message, null);

    FirebaseInAppMessaging.getInstance().setMessagesSuppressed(false);
}

@Override
protected void onResume() {
    super.onResume();
}

}

To display In App Messaging we need a Activity. I think we can only In App Messaging display on splash screen TWA but i didn't try it.

enter image description here

tesst
  • 11
  • 2