In-App Message Templates

InApp Utilities

In the event that you want to show the InApp scheme in a different way to how our SDK paints it, we put at your disposal some methods so that you can customize the "painting", without affecting the statistics or the InApp functionalities.

Get InApp object

InAppIndigitall.inAppGet(context, inAppId, new InAppCallback(context){    
    @Override
    public void onFail(Error error) {
        super.onFail(error);
    }

    @Override
    public void onSuccess(InApp inApp) {
        //DO SOMETHING
    }
});

Check if the InApp should be displayed
Thanks to the InApp functionalities (from version 4.18.0 ), it is possible to indicate that the inApp is displayed or pressed a maximum number of times, or if in the case of the popUp, after performing an action , such as pressing the close button, is not shown again. To do this we could do the following within the inAppGet method that we have seen previously:

InAppIndigitall.inAppGet(context, inAppId, new InAppCallback(context){    
    @Override
    public void onFail(Error error) {
        super.onFail(error);
    }

    @Override
    public void onSuccess(InApp inApp) {
        if (inApp.getProperties().getDismissForever() &&
                PopUpUtils.INSTANCE.isInAppDismissForever(context, inApp)) {
            //InApp was dismissed forever
        } else {
            InAppUtils.INSTANCE.inAppWasShown(context, inApp, new InAppWasShownCallback() {
                @Override
                public void didExpired() {
                    //InApp  was expired
                }

                @Override
                public void didShowMoreThanOnce() {
                    //InApp  was shown more than" + inApp.getProperties().getNumberOfShows() +" times"
                }

                @Override
                public void didClickOut() {
                    //InApp  was clicked more than " + inApp.getProperties().getNumberOfClicks()+ " times"
                }

                @Override
                public void onSuccess() {
                    //SHOW INAPP OR DO SOMETHING
                }
            });
        }
    }
});

Actions to count clicks or to not show InApp anymore
For the case of what we call Dismiss Forever, once the action is performed, this method must be called:

PopUpUtils.INSTANCE.addNewInAppToDismissForever(context, inApp);

In the event that you want to show an inApp only if you make 'x' clicks or clicks on it, you must add the following:

boolean isAppAction = inApp.getProperties().getAction().getType() == InAppAction.Type.APP;
Boolean result = InAppUtils.INSTANCE.inAppWasClicked(context, inApp, intent, isAppAction);
  • In this method the statistics of the click are sent, not just the click counter, so it returns a boolean just to confirm that everything has gone correctly.