Custom Event Triggers

Prev Next

Custom Event Triggers allow developers to define application events that can be used to trigger In-App Messages in Mapp Engage.

This page explains:

  • How to trigger custom events in the Android SDK (v6)

  • How to register events in Mapp Engage via API

  • How these events are used in In-App messaging campaigns

Custom Event Triggers enable dynamic targeting based on user behavior or app interactions.

Typical use cases include:

  • Showing a message when a user adds an item to the cart

  • Triggering a message when a specific screen is opened

  • Displaying contextual messages based on in-app activity


Triggering Events in the App

Custom Event Triggers are executed directly from the Android application using the SDK.

Developers define an event name and trigger it at the appropriate point in the application flow.

Example:

Appoxee.instance().triggerInApp(YourActivity.this, "EventName");

The EventName must match the event registered in Mapp Engage.


Registering Events in Mapp Engage

Before a custom event can be used in an In-App Message campaign, it must be registered in Mapp Engage.

Developers must import custom event triggers via an API call.

Prerequisites

  • An API account for the Mapp Engage system

  • The App ID of the mobile application


API Method

The registerAppEvents method allows developers to create a list of mobile app events in Mapp Engage.

API Details

  • Domain: mobile

  • Version: v10+

  • Purpose: Create custom mobile app events for In-App triggers

Note

The API version refers to the Mapp Engage backend API and is independent of the Android SDK version.


Parameters

Name

Type

Description

appId

Long

The ID of the app where events will be registered

events

MobileAppEvent[]

A list of mobile app events to create


Exceptions

Exception

Description

NoSuchObjectException

The specified App ID could not be found

InvalidParameterException

One or more parameters are invalid

UnexpectedErrorException

An unexpected backend error occurred


Example

import com.mapp.api.MobileAppEvent;

public class CustomEventTrigger {
    public static void main(String[] args) {
        Long appId = 12345L; // Replace with your App ID
        MobileAppEvent[] events = {
            new MobileAppEvent("eventName1", "eventDescription1"),
            new MobileAppEvent("eventName2", "eventDescription2")
        };

        try {
            MobileAPI.registerAppEvents(appId, events);
            System.out.println("Custom events registered successfully.");
        } catch (NoSuchObjectException e) {
            System.err.println("App ID not found: " + e.getMessage());
        } catch (InvalidParameterException e) {
            System.err.println("Invalid parameter: " + e.getMessage());
        } catch (UnexpectedErrorException e) {
            System.err.println("Unexpected error: " + e.getMessage());
        }
    }
}

For additional information, please refer to our API documentation.