Integration

Banner format

Below we tell you how to instantiate one or more In-App messages in banner format.

Remember that you should first have them defined in the indigitall console. See our user manual for more info.

Create a WebView view in your layouts. The size must match what you have defined in the indigitall console. Remember to translate the units from PX to DP.

If it is configured in the console that the banner is hidden for X seconds, you have to add to the call the activity in which the inApp is located and add the callback didDismissed where it will indicate that the established time has elapsed, returning the web the inApp code so that you can, for example, hide it.

One single banner

You can follow the example below:

<WebView
    android:id="@+id/myBanner"
    android:layout_width="230dp"
    android:layout_height="33.33dp"
/>

Instantiate the In-App message using the showInApp method.

ShowInAppCallback callback = new ShowInAppCallback() {
    @Override
    public void onLoad(String inAppCode, WebView webView) {
        // In-App content loaded
    }

    @Override
    public void onFail(String inAppCode, WebView webView, String errorDescription) {
        // Handle the loading error
    }

    @Override
    public void onShowTimeFinished(String inAppCode, WebView webView, int showTime) {
        // Optional: handle the configured display duration
    }
};

InAppIndigitall.showInApp(context, "myBanner_CODE", myBanner, callback);
  val callback = object : ShowInAppCallback() {
    override fun onLoad(inAppCode: String, webView: WebView) {
      // In-App content loaded
    }

    override fun onFail(inAppCode: String, webView: WebView, errorDescription: String) {
      // Handle the loading error
    }

    override fun onShowTimeFinished(inAppCode: String, webView: WebView, showTime: Int) {
      // Optional: handle the configured display duration
    }
  }

  InAppIndigitall.showInApp(context, "myBanner_CODE", myBanner, callback)

Multiple banner

You can follow the example below:

<WebView
    android:id="@+id/myBanner"
    android:layout_width="230dp"
    android:layout_height="33.33dp"
/>
<WebView
    android:id="@+id/otherBanner"
    android:layout_width="250dp"
    android:layout_height="36dp"
/>

Instantiate In-App messages using the showMultipleInApp method.

ShowInAppCallback callback = new ShowInAppCallback() {
    @Override
    public void onLoad(String inAppCode, WebView webView) {}
    @Override
    public void onFail(String inAppCode, WebView webView, String errorDescription) {}
    @Override
    public void onShowTimeFinished(String inAppCode, WebView webView, int showTime) {}
};

ArrayList<String> codes = new ArrayList<>(Arrays.asList("myBanner_CODE", "otherBanner_CODE"));
ArrayList<WebView> views = new ArrayList<>(Arrays.asList(myBanner, otherBanner));
InAppIndigitall.showMultipleInApp(context, codes, views, callback);
  val callback = object : ShowInAppCallback() {
    override fun onLoad(inAppCode: String, webView: WebView) {}
    override fun onFail(inAppCode: String, webView: WebView, errorDescription: String) {}
    override fun onShowTimeFinished(inAppCode: String, webView: WebView, showTime: Int) {}
  }

  InAppIndigitall.showMultipleInApp(
    context,
    arrayListOf("myBanner_CODE", "otherBanner_CODE"),
    arrayListOf(myBanner, otherBanner),
    callback
  )

Popup Format

Next we tell you how to instantiate an In-App message in popup format.
Remember that you should first have it defined in the indigitall console. See our user manual for more info.

You have to add parent view where you want to show the popup. The size must match what you have defined in the indigitall console. Remember to translate the units from PX to DP.

View parentView = findViewById(R.id.activity_main);
ShowInAppCallback callback = new ShowInAppCallback() {
    @Override
    public void onLoad(String inAppCode, WebView webView) {}
    @Override
    public void onFail(String inAppCode, WebView webView, String errorDescription) {}
    @Override
    public void onShowTimeFinished(String inAppCode, WebView webView, int showTime) {}
};

InAppIndigitall.showPopUp(parentView, context, "myPopup_CODE", callback);
val callback = object : ShowInAppCallback() {
    override fun onLoad(inAppCode: String, webView: WebView) {}
    override fun onFail(inAppCode: String, webView: WebView, errorDescription: String) {}
    override fun onShowTimeFinished(inAppCode: String, webView: WebView, showTime: Int) {}
}

InAppIndigitall.showPopUp(parentView, context, "myPopup_CODE", callback)

If you want to customize the icon to close the Popup, you can do it with the following method to which you can pass a custom ImageButton , if you wanted to use our icon, just pass a null. The closeIconDisabled parameter is in case you don't want to show any icon, setting it to true to hide it or false to show it.

Close popup when clicked

If you want to close popup when it is clicked, you have to add on InApp configuration object, setClosePopupWhenClicked boolean param.

ConstraintLayout parentView = findViewById(R.id.myPopupParentLayout);
ImageButton closeButton = new ImageButton(context);
boolean closeIconDisabled = false;

InAppConfiguration configuration = new InAppConfiguration.Builder("YOUR_APP_KEY")
        .setUrlInAppApi("https://device-api.indigitall.com/v2")
        .setClosePopupWhenClicked(true)
        .build();

ShowInAppCallback callback = new ShowInAppCallback() {
    @Override
    public void onLoad(String inAppCode, WebView webView) {}
    @Override
    public void onFail(String inAppCode, WebView webView, String errorDescription) {}
    @Override
    public void onShowTimeFinished(String inAppCode, WebView webView, int showTime) {}
};

InAppIndigitall.showPopUp(
        configuration, context, parentView, "myPopup_CODE", closeButton, closeIconDisabled, callback);
val configuration = InAppConfiguration.Builder("YOUR_APP_KEY")
    .setUrlInAppApi("https://device-api.indigitall.com/v2")
    .setClosePopupWhenClicked(true)
    .build()

val closeIconDisabled = false
val callback = object : ShowInAppCallback() {
  override fun onLoad(inAppCode: String, webView: WebView) {}
  override fun onFail(inAppCode: String, webView: WebView, errorDescription: String) {}
  override fun onShowTimeFinished(inAppCode: String, webView: WebView, showTime: Int) {}
}

InAppIndigitall.showPopUp(
    configuration,
    context,
    parentView,
    "myPopup_CODE",
    null,
    closeIconDisabled,
    callback
)