Track Custom Event for Exit Intent

MoEngage SDK optionally notifies the application whenever the goes to background. Application can track the custom event in this callback for exit intent.

To get notified implement the below interface.

/**
 * Callback listener trigger whenever the application goes to background.
 * Usage: <br>
 * Setting listener
 * <pre>
 *   <code>
 *     MoEHelper.getInstance(mContext).registerAppBackgroundListener(listener);
 *   </code>
 * </pre>
 * Remove Listener
 * <pre>
 *   <code>
 *     MoEHelper.getInstance(mContext).unregisterAppBackgroundListener()
 *   </code>
 * </pre>
 *
 * @since 9.2.01
 */
public interface OnAppBackgroundListener {
  void goingToBackground();
}

Once the interface is implemented register the interface using the below register API.

MoEHelper.getInstance(getApplicationContext()).registerAppBackgroundListener();