In-app notifications SDK for Android

This page details how to add in-app notification support with Ortto’s Android software development kit (SDK). In-app notifications are capture widgets shown on mobile devices.

Because in-app notifications are a type of widget, they do not require the customer or contact to opt-in to receive them. You simply need to configure your app to support in-app notifications and create a popup widget configured to display on Android devices in Ortto.

If your app is developed using Flutter, you can find a combined push notification and in-app notification SDK here.

Prepare a popup widget in Ortto

In addition to following the in-app notification SDK guide below, you will need to create a new or configure an existing popup-type capture widget in Ortto.

The popup widget needs to be configured to include Android under the Platform and pages setting. Learn more about configuring a popup widget for in-app notifications In-app notifications, under Creating a new capture widget.

Initialize the capture SDK

To start, import the CaptureConfig class.


import com.ortto.messaging.widget.CaptureConfig;

Then, add the following code block to the Application.onCreate method, which is usually in your file:


Ortto.instance().initCapture(new CaptureConfig( "<Datasource ID>", "<Capture JS URL>", "<API Endpoint>" ));

NOTE: The elements Datasource ID, Capture JS URL and API Endpoint are found in your Ortto account's settings at Settings > In-app notifications > Android in-app notifications.

Trigger in-app notifications from push notifications

In-app notifications can be triggered from push notifications, when configured correctly within Ortto and via the SDK.

To trigger a capture widget from a push notification, in Ortto you need to:

  1. Create a popup-type capture widget.
  2. Create a push notification.
  3. In the push notification, set the primary action to Show widget and select the relevant popup widget.

For more detailed setup instructions, read In-app notifications, under Creating a new capture widget.

When both the push notification and popup a widget are switched ON, they will be linked so that when a user clicks on the push notification, it will trigger the popup widget to show.

NOTE: If a capture widget has been queued, it will appear shortly after the application has been foregrounded by the user. If there are multiple notifications in the queue, they will appear one after another with a short delay in between.

Manually show or queue in-app notifications

When you have created a popup-type capture widget in Ortto (and it is turned ON), you can choose to manually show or queue the widget.

You will need the widgetId, which you can find in the widget URL in Ortto. For example:

To queue a widget to be shown at a later time (e.g. when the user foregrounds the application):



To show a widget immediately:



To start processing any queued widgets (they will begin to show after a short delay):



NOTE: This method is called automatically when the app is foregrounded, or if network connectivity is re-established.