
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.
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 callshowNudge()
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.
Multiple Self-Handled InApps
To fetch multiple self-handled in-apps, call thegetSelfHandledInApps() 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
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
- Add the API call in the Android native part of your app
- Call MoEngage plugin’s onOrientationChanged()