Skip to main content
InApp 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. In App NATIV1

Install Android Dependency

Install using BOM

Integration using BOM  is the recommended way of integration; refer to the Install Using BOM document . Once you have configured the BOM add the dependency in the app/build.gradle file as shown below:
Once the BOM is configured, include the specific MoEngage modules required for the application. 
Note: Version numbers are not required for these dependencies; the BOM automatically manages them.

Requirements for displaying images and GIFs in InApp

Starting InApp version 7.0.0, SDK requires Glide to show images and GIFs in the in-apps. You need to add the below dependency in your build.gradle file.

Display InApp

Call the showInApp() wherever InApp has to be shown in the app as shown below: 

Display Nudges

Starting with capacitor-moengage-coreversion 6**.0.0,**MoEngage InApp SDK supports displaying Non-Intrusive nudges.   To show a Nudge InApp Campaign call showNudge()

InApp/Nudge Redirection default behavior

On clicking an Inapp or Nudge, MoEngage SDKs will handle only rich landing navigation redirection.  For the screen name and deep link redirection, your app code should redirect the user to the right screen or deep link. To handle the screen name and deep link redirection, you must implement inapp click callback methods. MoEngage SDK will just pass the inapp payload to this call back code. Implementation steps are mentioned in the InApp callback section of the Integration.

Self-Handled InApps

Single Self-Handled InApps

Self-handled In Apps are messages which are delivered by the SDK but displaying it has to be handled by the App.
To get self-handled In-App call the below method.
The payload for self-handled in-app is returned via a callback. Register a callback as shown below.

Multiple Self-Handled InApps

To fetch multiple self-handled in-apps, call the getSelfHandledInApps() method. This returns a promise containing the MoEInAppSelfHandledCampaignsData object.
TypeScript

Tracking Statistics

Since display, click, and dismiss for Self-Handled InApp is controlled by the application we need you to notify the SDK whenever the In-App is Shown, Clicked, or Dismissed. Below are the methods you need to call to notify the SDK. The campaign object provided to the application in the callback for self-handled in-app should be passed in as a parameter to the below APIs.

InApp Callbacks

The callbacks must be registered before inapps are displayed either via show methods or triggered events. Make sure you are calling initialize() the method of the plugin after you set up these callbacks. Refer doc for more info.
We provide callbacks whenever an InApp campaign is shown, dismissed, or clicked you can register for the same as shown below. Use this call both Intrusive InApps and Non-Intrusive Nudge InApps to handle action. 

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 to set the context, before calling showInApp().

Reset Context

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

Payload Structure

Handling Orientation Change

This is only for the Android platform
MoEngage SDK has to be notified when the device orientation changes for SDK to handle in-app display. There are two ways to do it:
  1. Add the API call in the Android native part of your app
  2. Call MoEngage plugin’s onOrientationChanged()

Add the API call in the Android native part of your app

Notify the SDK when onConfigurationChanged() API callback is received in your App’s Activity class.

Call the MoEngage plugin’s orientation change API

Call the below API to notify SDK of the orientation change.