Method Library for Android SDK v6

Prev Next

This page lists public methods for Android Mobile SDK in Mapp Engage.

Initialization Methods

Engage

The Engage method initializes the SDK by injecting connection parameters. It accepts two parameters:

  1. Application instance: Used as the context.

  2. AppoxeeOptions: Contains values required to connect to a backend service, including:

    • Server

    • SdkKey

    • TenantID

    • AppID

Engage Call

Once the SDK is ready, it can be accessed using the static method Instance.

Setup Methods

Setup methods allow user-level customization and configuration for enhanced engagement. These methods are only callable once the SDK is initialized.

SDK Status

Is Ready

Checks whether the Mapp SDK is properly initialized. Returns true if ready; otherwise, false.

public boolean isReady()

Is Ready Call

boolean isReady = Appoxee.instance().isReady();

Device Information

Get Device Info

Retrieves stored information about a registered device. This data is essential for other methods.

public DeviceInfo getDeviceInfo()

Get Device Info Call

DeviceInfo deviceInfo = Appoxee.instance().getDeviceInfo();

Alias Management

Set Alias

Sets a user alias in a format convenient for the client’s system.

public RequestStatus setAlias(String alias)

Set Alias Call

Appoxee.instance().setAlias("alias@example.com");

Get Alias

Returns the current alias for a registered user.

public String getAlias()

Get Alias Call

String alias = Appoxee.instance().getAlias();

Push Notifications

Set Push Enabled

Enables or disables push notifications.

public RequestStatus setPushEnabled(boolean isPushEnabled)

Set Push Enabled Call

Appoxee.instance().setPushEnabled(true); // or false

Is Push Enabled

Checks whether push notifications are enabled.

public boolean isPushEnabled()

Is Push Enabled Call

boolean isEnabled = Appoxee.instance().isPushEnabled();

User Management

Logout

Logs out a user, resets the alias, and toggles push notifications.

public void logOut(boolean pushEnable)

Logout Call

Appoxee.instance().logout(true); // or false

Firebase Token Management

Set Token

Registers a Firebase token for push notifications.

public void setToken(String token)

Set Token Call

Appoxee.instance().setToken("FIREBASE_TOKEN");

Get Token

Retrieves the registered Firebase token.

public void getFcmToken(ResultCallback<String> callback)

Get Token Call

Appoxee.instance().getFcmToken(token -> Log.d(TAG, token));

Custom Attributes

Set Attribute

Allows defining custom attributes for campaign targeting. Supported types:

  • Boolean

  • Date

  • Number

  • String

Set Attribute Call

Appoxee.instance().setAttribute("key", value);

Get Custom Attribute Value

Retrieves the value of a custom attribute as a string.

public String getAttributeStringValue(String key)

Get Custom Attribute Value Call

String value = Appoxee.instance().getAttributeStringValue("key");

Get Custom Attributes

Fetches a list of custom attributes.

public RequestStatus getCustomAttributes(boolean persist, List<String> attributesKeys, GetCustomAttributesCallback callback)

Get Custom Attributes Call

        Appoxee.instance().getCustomAttributes(true, customAttributesNames, new GetCustomAttributesCallback() {
            @Override
            public void onSuccess(Map<String, String> customAttributes) {
                runOnUiThread(new Runnable() {
                      // use the returned list of custom attributes
                });
            }

            @Override
            public void onError(String exception) {
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                       // handle error
                    }
                });
            }
        });

Remove Attribute

Deletes a custom attribute.

public void removeAttribute(String key)

Remove Attribute Call

Appoxee.instance().removeAttribute("key");

Tags

Add Tag

Adds a tag to a device.

public RequestStatus addTag(String tag)

Add Tag Call

Appoxee.instance().addTag("tag");

Get Tags

Retrieves a list of tags applied to a device.

public Set<String> getTags()

Get Tags Call

Set<String> tags = Appoxee.instance().getTags();

Remove Tag

Removes a tag from a device.

public RequestStatus removeTag(String tag)

Remove Tag Call

Appoxee.instance().removeTag("tag");

Inbox Messages

Fetch Inbox Messages

Fetches a list of inbox messages.

public void fetchInboxMessages()

Fetch Inbox Messages Call

InAppInboxCallback inAppInboxCallback = new InAppInboxCallback();
inAppInboxCallback.addInAppInboxMessagesReceivedCallback(new InAppInboxCallback.onInAppInboxMessagesReceived() {
     @Override
     public void onInAppInboxMessages(List<APXInboxMessage> richMessages) {
           Log.d(TAG, "messages = " + richMessages);
     }

     @Override
     public void onInAppInboxMessage(APXInboxMessage message) {

     }
});
Appoxee.instance().fetchInboxMessages();

Fetch Single Inbox Message

Fetches a specific message by template ID.

public void fetchInboxMessage(int templateId)

Fetch Inbox Message Call

Appoxee.instance().fetchInboxMessage(messageId);

Rich Push Messages

Handle Rich Push Messages

Handles multimedia-rich push messages. This method should be called in MainActivity or similar.

public static RequestStatus handleRichPush(Context context, Intent intent)

Handle Rich Push Call

Appoxee.handleRichPush(this, intent);

Geofencing

Start Geofencing

Initiates geofencing for location-based engagement.

public void startGeoFencing(ResultCallback<String> callback)

Start Geofencing Call

    private final ResultCallback<String> geofenceCallback = new ResultCallback<>() {
        @Override
        public void onResult(@Nullable String result) {
            devLogger.d(result);
            if (result != null) {
                switch (result) {
                    case GeofenceStatus.GEOFENCE_STARTED_OK:
                        Toast.makeText(MainActivity.this, "Geofence started successfully", Toast.LENGTH_SHORT).show();
                        break;
                    case GeofenceStatus.GEOFENCE_STOPPED_OK:
                        Toast.makeText(MainActivity.this, "Geofence stopped successfully", Toast.LENGTH_SHORT).show();
                        break;
                    default:
                        Toast.makeText(MainActivity.this, result, Toast.LENGTH_SHORT).show();
                        break;
                }
            }
        }
    };

    Appoxee.instance().startGeoFencing(geofenceCallback);

Stop Geofencing

Stops the geofencing service.

public void stopGeoFencing(@Nullable ResultCallback<String> callback)

Stop Geofencing Call

Appoxee.instance().stopGeoFencing(geofenceCallback);

Is Geofencing Activated

Checks if geofencing is active.

public boolean isGeofencingActive()

Is Geofencing Activated Call

boolean isGeoActive = Appoxee.instance().isGeofencingActive();

Event Notifier Methods

Initialization Listeners

Add Init Listener

Registers a listener for SDK initialization events.

public void addInitListener(OnInitCompletedListener onInitCompletedListener)

Add Init Listener Call

    private final Appoxee.OnInitCompletedListener initFinishedListener = new Appoxee.OnInitCompletedListener() {
        @Override
        public void onInitCompleted(boolean successful, Exception failReason) {
            Log.i("APX", "init completed listener - Application class");
        }
    };

    @Override
    public void onCreate() {
        super.onCreate();
		// other initialisation part
        Appoxee.instance().addInitListener(initFinishedListener);
    }

Remove Init Listener

Removes a previously added initialization listener.

public void removeInitListener(OnInitCompletedListener onInitCompletedListener)

Remove Init Listener Call

Appoxee.instance().removeInitListener(this);

Push Event Receivers

Register Push Events Receiver

Registers a class to handle push message events (e.g., clicked, opened, dismissed).

public synchronized void setReceiver(Class receiver)

Register Push Events Receiver Call

Appoxee.instance().setReceiver(MyPushBroadcastReceiver.class);

Note: MyPushBroadcastReceiver must subclass PushDataReceiver.