By default In-Apps are shown on Activity Lifecycle Callbacks and no additional integration is required for using In-Apps.
This feature is available from SDK version 9.4.01 and above.
In-App notifications are triggered only on Activity Lifecycle Callbacks, hence if your application has a Single Activity and multiple fragments In-App message will only be shown on application launch which might not always be an ideal behaviour and you want to trigger in-app at a later point of time in the application's lifecycle.
To have such control you can call
MoEInAppHelper.getInstance().showInApp(context) in the
onResume() of your Fragment or
onStart() of your activity. Refer to the API documentation for more details.
Before you can use this method to control in-app display you need to opt-out of the default behaviour on lifecycle callbacks. To opt-out call
optOutDefaultInAppDisplay() in the MoEngage Builder when initialising the SDK. Refer to the documentation for more details on this API.
Note: In-Apps can only be triggered via Activity lifecycle callbacks or
MoEInAppHelper.getInstance().showInApp(context) both cannot be used simultaneously.
Refer to this link to read more about how to create and test in-apps.
If you want to suppress the In-APP in a particular activity for e.g., the Payment page or splash screen add the activity list in the initialiser object as shown below
ArrayList<Class> inAppOptOut = new ArrayList<>(); inAppOptOut.add(MainActivity.class); MoEngage moEngage = new MoEngage.Builder(this, "XXXXXXXXXX") .setInAppOptOut(inAppOptOut) .build(); MoEngage.initialise(moEngage);
This would suppress from any inapp message from showing up in that activity.
Nudges are non disruptive messages which can be placed anywhere in the activity.
Add the following code in the activity/fragment layout file.
<com.moengage.widgets.NudgeView android:id="@+id/nudge" android:layout_width="match_parent" android:layout_height="wrap_content" > </com.moengage.widgets.NudgeView>
In your activity's,
onCreate() add the following lines of code.
NudgeView nv = (NudgeView)findViewById(R.id.nudge); nv.initialiseNudgeView(activity); //pass the activity context
If you are using nudges in Fragments then get an instance of the nudge view in the
onCreateView() as follows
NudgeView nv = (NudgeView)findViewById(R.id.nudge);
Initialise the nudge view in the
onResume() of the fragment
In-App messages support GIFs with Fresco
To use GIFs you need to add below dependency in your
compile 'com.facebook.fresco:fresco:1.12.1' compile 'com.facebook.fresco:animated-gif:1.12.1'
You also need to initialise the Fresco SDK, follow the Getting Started Page of the library for more details.
|Preparing for Release|