Skip to main content
In-App Messaging is custom views that you can send to a segment of users to show custom messages or give new offers or take to some specific pages. They can be created from your MoEngage account. In App NATIV1

Installing Android Dependency

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.
 
Additional dependency installation is not required for iOS.

Show InApp

Call the below API to show an inApp campaign on a screen. You will have to handle the redirection of the user when they click on the inApps unless it’s a rich landing navigation.

Display Nudges

Starting with moengage_flutter version 7.0.0 MoEngage InApp SDK supports displaying Non-Intrusive nudges. This API is supported only in Android & IOS. You will have to handle the redirection of the user when they click on the inApps unless it’s a rich landing navigation. 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

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.
To get the self-handled campaign, register for the callback as shown below.

Multiple Self-Handled InApps

  • This feature requires a minimum moengage_flutter version 9.0.0
  • Event-triggered multiple self-handled inapps are not supported.
Fetch Multiple Self Handled Campaigns using getSelfHandledInApps(). The MoEngage SDK will return up to 5 campaigns(in the order of campaign priority set at the time of campaign creation). The function will return self-handled in-app data in the future. 
It will return data of type SelfHandledInAppsData

Tracking Statistics for Multiple Self-Handled In-Apps

The onCampaignsAvailable() callback method returns SelfHandledCampaignsData**,**which contains a list of SelfHandledCampaignData objects. The statistics for each SelfHandledCampaignData object must be tracked individually below APIs.

Fetching Contextual Multiple Self-Handled InApps

To fetch contextual multiple self-handled inapps, set the inapp contexts using setCurrentContext() before calling *getSelfHandledInApps().*This will return a list of contextual and non-contextual inapps(in the order of campaign priority set at the time of campaign creation).  

Tracking Statistics for Self-Handled In-Apps

The application must 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.

InApp Callbacks

We provide callbacks for in-app shown, in-app clicked,  in-app dismissed, and self-Handled in-app available events. You can register for the same as shown below.
The callbacks must be registered before inapps are displayed either via show methods or triggered events. Make sure you are calling initialise() the method of the plugin after you set up these callbacks. Refer doc for more info.

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. To set the user’s context in the application use setCurrentContext() API as shown below. 

Set Context

Call the below method to set the context in the initState() method of the widget before calling showInApp().

Reset Context

Once the user is moving out of the context use the resetCurrentContext() API to reset/clear the existing context. 
For more information on Contextual InApp, refer to the video tutorial available in Troubleshooting and FAQs.

InApp Payload

InApp Data will be received in the below format:

Handling Orientation Change

This is only for the Android platform
Starting SDK version 4.1.0 in-apps are supported in both portrait and landscape modes.
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 MoEngage plugin’s orientation change API

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