问题
Hi I've recently added InAppMessaging to my project which seems to be easy to integrate, but for me doesn't work as it's expected.
First of all I've added this to the build.gradle :
implementation 'com.google.firebase:firebase-core:17.0.1'
implementation 'com.google.firebase:firebase-inappmessaging-display:18.0.2'
then and because I don't want to show the message at the splash screen (IntroActivity.java) I'm doing :
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
binding = DataBindingUtil.setContentView(this, R.layout.activity_intro);
binding.setActivity(this);
//Disabling firebase in app messaging
FirebaseInAppMessaging.getInstance().setMessagesSuppressed(true);
}
For the MainActivity.java I'm stopping the suppressing at the onStart :
@Override
protected void onStart() {
super.onStart();
FirebaseInAppMessaging.getInstance().setMessagesSuppressed(false);
}
The structure of the main activity is a FragmentLayout with a bottom navigation bar, that fragment layout has 4 different fragments, the first one (the one that is loaded at the beginning) has different recycler views showing information coming from the API (data loaded at the intro, using Apollo GraphQL for Android).
Finally I create the InAppMessage going to Firebase Console -> InAppMessaging -> New Campaign -> Card, setting al the basic info like title and image -> target -> select my app -> Scheduling -> no ending date and events : "app_launch" and "on_foreground" -> then next and publish.
When I restart the app, after the intro activity I can see the InAppMessage for a sec and then disappears, I wonder if it's related to the suppressing, or for some reason when the message is shown the recycler views of the main fragment are not shown and when they get created are disabling the msg?
Any clue or thought will be welcome. Thanks
来源:https://stackoverflow.com/questions/57213730/inappmessage-auto-disappears-once-is-shown