In-App NATIV Campaigns target your users by showing a message while the user is using your app. They are very effective in providing contextual information and help to cross-sell/up-sell on desired screens of your app or/and on desired actions performed by the user in your app.


SDK Installation

Installing using Catalog

Integration using a Version Catalog is the recommended way of integration; refer to the Configure Version Catalog document to configure a catalog if you still need to do so. Once you have configured the catalog add the dependency in the app/build.gradle file as shown below

dependencies {

Alternatively, you can add the dependency directly, as shown below.

Installing using Artifact Id

Add the following dependency in the app/build.gradle file.

dependencies {

replace $sdkVersion with the appropriate SDK version

Display InApp

To show an InApp Campaign call MoEInAppHelper.getInstance().showInApp(context) from the onResume() of your Fragment or onStart() of your activity.


Handling Configuration change

Starting SDK version 11.4.00, in-apps are supported in both portrait and landscape modes. SDK internally handles in-app display on orientation change when the activity restart is handled by the system.

In case your activity is handling the configuration change by itself, you have to notify the SDK by invoking MoEInAppHelper.getInstance().onConfigurationChanged() API for SDK to redraw the in-app when the activity receives onConfigurationChanged() callback from the framework.

Kotlin Java
override fun onConfigurationChanged(newConfig: Configuration) {

GIF In Apps

SDK supports showing Gif in In-App messages using Glide.
To use GIFs, you need to add the below dependency in your build.gradle file.

dependencies {

Implementing Nudges

Nudges are non-disruptive messages which can be placed anywhere in the activity.


Add the following code in the activity/fragment layout file.

    android:layout_height="wrap_content" >

Using in an Activity

Get an instance of the nudge view in the onCreate() and initialize the nudge view in the onStart() of the Activity.

Using in a Fragment

Get an instance of the nudge view in the onCreateView() and initialize the nudge view in the onResume() of the fragment.

Use the below code to get the instance of the NudgeView and initialize it.

Kotlin Java
// get instance of the view
val nudge = findViewById(
// initialize

Contextual InApp

You can restrict the in-apps based on the user's context in the application, apart from restricting InApp campaigns on a specific screen/activity. To set the user's context in the application, use setInAppContext() API, as shown below.

Set Context

Call the below method in the onStart() of your Activity or Fragment before calling showInApp().

Kotlin Java
MoEInAppHelper.getInstance().setInAppContext(setOf("context1", "context2", "context3"))

The context is not the same context as Android Context.  This user's context in the application flow.

Reset Context

Once the user is moving out of the context, use the restInAppContext() API to reset/clear the existing context.

Kotlin Java

Self Handled InApps

Self-handled In Apps are messages that are delivered by the SDK to the application, and the application builds the UI using the delivered payload by the SDK. To get the self-handled in-app, use the below API.

Kotlin Java
MoEInAppHelper.getInstance().getSelfHandledInApp(context, listener)

The listener is an instance of SelfHandledAvailableListener.

This method should be called in the onResume() of your Fragment or onStart() of your activity.
The above method is asynchronous and does not return the payload immediately, once the payload is available onSelfHandledAvailable() callback of the listener would be called with the payload.

Tracking Statistics for Self Handled In-Apps

The application needs to notify MoEngage SDK whenever the In-App messages are displayed, clicked on, or dismissed, as the application controls these actions. The following methods are called to notify the SDK. The data object provided to the application in the callback for self-handled in-app should be passed as a parameter to the following APIs.

Kotlin Java
// call whenever in-app is shown
MoEInAppHelper.getInstance().selfHandledShown(context, data)
// call whenever in-app is clicked
MoEInAppHelper.getInstance().selfHandledClicked(context, data)
// call whenever in-app is dismissed
MoEInAppHelper.getInstance().selfHandledDismissed(context, data)

For more information, refer to the API documentation.

Event-Triggered Self Handled InApps

To get a callback for for event triggered, implement SelfHandledAvailableListener and register for a listener using MoEInAppHelper.getInstance().setSelfHandledListener(). SDK will notify the registered listener once the campaign is available.

We recommend registering this listener in the onCreate() of the Application class if the trigger event can happen on multiple screens.

In-Apps Callback

Lifecycle callback

To get callbacks whenever an InApp campaign is shown or dismissed, implement the InAppLifeCycleListener and register for the callbacks using MoEInAppHelper.getInstance().addInAppLifeCycleListener().

Click Callback

To handle user navigation or custom action, SDK provides a callback whenever an in-app widget is clicked with either Navigation or Custom action. To get callbacks implement the OnClickActionListener interface and register for the callbacks using MoEInAppHelper.getInstance().setClickActionListener().

Blocking InApps on Screens

Additionally, you can block in-app on a specific screen or handle the status bar visibility using the InAppConfig object and pass it to the SDK using the MoEngage.Builder object. Use the configureInApps() API to pass on the configuration to the SDK.

Kotlin Java
// Set of activity classes on which in-app should not be shown
val inAppOptOut = mutableSetOf<Class<*>>()
val moengage = MoEngage.Builder(application, "XXXXXXXX")
    .configureInApps(InAppConfig(true, inAppOptOut))

Testing In-App

Refer to this link to read more about how to create and test in-apps.

Version Compatibility

The inapp artifact or module is dependent on the Core SDK or moe-android-sdk artifact or module.
Based on the version of the Core SDK you are using, choose the right version of the InApp module.

Core SDK Version InApp Version
12.2.02 and later 6.2.0 and later


Was this article helpful?
1 out of 4 found this helpful

How can we improve this article?