
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:Note: Version numbers are not required for these dependencies; the BOM automatically manages them.
Manual installation
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.How to show In-App Messages?
Use showInApp() method to show inApp as shown below:Nudges
Nudges are non-intrusive In-App messages that can be displayed at various positions on the screen. Use the showNudge() method to display them: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.Context-Based InApps
We have introduced context-based InApps. While creating InApp campaigns you can set the contexts OR tags to the campaign. SDK will check with the current context set in the App and show the inApp only when a current set context matches the campaign context.Set Current Context:
To set the current context for the InApp module use setCurrentContext() method as shown below:Reset Context:
To reset the current context for the InApp module call resetCurrentContext() method:Self Handled In-App Messaging
The SDK does not show self-handled In-Apps. While creating the campaign, a JSON payload has to be provided in the dashboard. The same payload will be provided to the app by the SDK on calling the getSelfHandledInApp() method, and info will be received by a callback post all the delivery controls are checked:In-App Messaging Rules
We use the following rules while showing the In-App: Preconditions for In-App to work:- If InApp Backend Sync was successful in the current session or not.
- Check if the Device is NOT iPad/Tablet.
- Check if InApp is disabled on the current screen.
- Check Device Orientation is Portrait(Landscape is not supported).
- Check Global Delay has lapsed, skip this if Ignore Global Delay set for the campaign.
- Check if the campaign has expired
- Display Rules
- Check Show Only on Screen
- Check with current contexts
- Delivery Controls
- Persistence Check(If the primary action of InApp is done but still want to show the inApp)
- Check if the campaign has been shown max times
- Check if the campaign level delay has crossed.
Callback in JavaScript on In-App Events
To get a callback in javascript on in-app events you need to register for a click listener as shown below. Minimum Plugin version required: 6.0.0Payload Structure in Callbacks
InAppInfo received in the callbacks above have the following structure:Handling Orientation Change
This is only for the Android platform.
- Add the API call in the Android native part of your app
- Call MoEngage plugin’s onOrientationChanged()