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.
InAppIndigitall.showInApp(
context,
"myBanner_CODE",
view,
null)
InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("https://device-api.indigitall.com/v2");
inAppConfig.build();
InAppIndigitall.showInApp(
context,
inAppConfig,
"myBanner_CODE",
view,
new ShowInAppCallback() {
@Override
public void onLoad(String s, WebView webView) {
log.d("InApp Loaded ").writeLog();
}
@Override
public void onFail(String s, WebView webView, String s1) {
log.d("InApp onFail " + s1).writeLog();
}
@Override
public void onShowTimeFinished(String s, WebView webView, int i) {
log.d("InApp onShowTimeFinished ").writeLog();
}
@Override
public void didClicked(InApp inApp, InAppAction action) {
super.didClicked(inApp, action);
log.d("InApp didClicked ").writeLog();
}
@Override
public void didClosed() {
super.didClosed();
log.d("InApp didClosed ").writeLog();
}
@Override
public void didExpired(InApp inApp, InAppErrorModel errorModel) {
super.didExpired(inApp, errorModel);
log.d("InApp didExpired ").writeLog();
}
@Override
public void didClickOut(InApp inApp, InAppErrorModel errorModel) {
super.didClickOut(inApp, errorModel);
log.d("InApp didClickOut " ).writeLog();
}
@Override
public void didShowManyTimes(InApp inApp, InAppErrorModel errorModel) {
super.didShowManyTimes(inApp, errorModel);
log.d("InApp didShowManyTimes ").writeLog();
}
@Override
public void didDismissed() {
super.didDismissed();
log.d("InApp didDismissed ").writeLog();
}
@Override
public void didDismissForever(InApp inApp, InAppErrorModel errorModel) {
super.didDismissForever(inApp, errorModel);
log.d("InApp didDismissForever ").writeLog();
}
@Override
public void onSuccess(InApp inapp) {
super.onSuccess(inapp);
log.d("InApp onSuccess ").writeLog();
}
@Override
public void didFormError(InApp inApp, ArrayList<InAppErrorModel> errorList) {
log.d("InApp didFormError: "+inApp.getSchema().getCode()).writeLog();
for (InAppErrorModel errorModel: errorList) {
log.d("With errorCode: " + errorModel.getErrorCode().getErrorId() + "\nError Message: " + errorModel.getErrorMessage().getErrorMessage() + "\nDescription: " + errorModel.getDescriptionMessage()).writeLog();
}
}
}
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 showInApp method.
InAppIndigitall.showMultipleInApp(
context,
codeList,
viewList,
null)
InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("URL_INAPP_V2");
inAppConfig.build();
InAppIndigitall.showMultipleInApp(
context,
inAppConfig,
codeList,
viewList,
new ShowInAppCallback() {
@Override
public void onLoad(String s, WebView webView) {
log.d("InApp Loaded ").writeLog();
}
@Override
public void onFail(String s, WebView webView, String s1) {
log.d("InApp onFail " + s1).writeLog();
}
@Override
public void onShowTimeFinished(String s, WebView webView, int i) {
log.d("InApp onShowTimeFinished ").writeLog();
}
@Override
public void didClicked(InApp inApp, InAppAction action) {
super.didClicked(inApp, action);
log.d("InApp didClicked ").writeLog();
}
@Override
public void didClosed() {
super.didClosed();
log.d("InApp didClosed ").writeLog();
}
@Override
public void didExpired(InApp inApp, InAppErrorModel errorModel) {
super.didExpired(inApp, errorModel);
log.d("InApp didExpired ").writeLog();
}
@Override
public void didClickOut(InApp inApp, InAppErrorModel errorModel) {
super.didClickOut(inApp, errorModel);
log.d("InApp didClickOut " ).writeLog();
}
@Override
public void didShowManyTimes(InApp inApp, InAppErrorModel errorModel) {
super.didShowManyTimes(inApp, errorModel);
log.d("InApp didShowManyTimes ").writeLog();
}
@Override
public void didDismissed() {
super.didDismissed();
log.d("InApp didDismissed ").writeLog();
}
@Override
public void didDismissForever(InApp inApp, InAppErrorModel errorModel) {
super.didDismissForever(inApp, errorModel);
log.d("InApp didDismissForever ").writeLog();
}
@Override
public void onSuccess(InApp inapp) {
super.onSuccess(inapp);
log.d("InApp onSuccess ").writeLog();
}
@Override
public void didFormError(InApp inApp, ArrayList<InAppErrorModel> errorList) {
log.d("InApp didFormError: "+inApp.getSchema().getCode()).writeLog();
for (InAppErrorModel errorModel: errorList) {
log.d("With errorCode: " + errorModel.getErrorCode().getErrorId() + "\nError Message: " + errorModel.getErrorMessage().getErrorMessage() + "\nDescription: " + errorModel.getDescriptionMessage()).writeLog();
}
}
}
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 view = findViewById(R.id.activity_main)
InAppIndigitall.showPopUp(
context,
"myBanner_CODE",
view,
null)
InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("URL_INAPP_V2");
inAppConfig.build();
InAppIndigitall.showPopUp(
context,
inAppConfig,
"myBanner_CODE",
view,
new ShowInAppCallback() {
@Override
public void onLoad(String s, WebView webView) {
log.d("InApp Loaded ").writeLog();
}
@Override
public void onFail(String s, WebView webView, String s1) {
log.d("InApp onFail " + s1).writeLog();
}
@Override
public void onShowTimeFinished(String s, WebView webView, int i) {
log.d("InApp onShowTimeFinished ").writeLog();
}
@Override
public void didClicked(InApp inApp, InAppAction action) {
super.didClicked(inApp, action);
log.d("InApp didClicked ").writeLog();
}
@Override
public void didClosed() {
super.didClosed();
log.d("InApp didClosed ").writeLog();
}
@Override
public void didExpired(InApp inApp, InAppErrorModel errorModel) {
super.didExpired(inApp, errorModel);
log.d("InApp didExpired ").writeLog();
}
@Override
public void didClickOut(InApp inApp, InAppErrorModel errorModel) {
super.didClickOut(inApp, errorModel);
log.d("InApp didClickOut " ).writeLog();
}
@Override
public void didShowManyTimes(InApp inApp, InAppErrorModel errorModel) {
super.didShowManyTimes(inApp, errorModel);
log.d("InApp didShowManyTimes ").writeLog();
}
@Override
public void didDismissed() {
super.didDismissed();
log.d("InApp didDismissed ").writeLog();
}
@Override
public void didDismissForever(InApp inApp, InAppErrorModel errorModel) {
super.didDismissForever(inApp, errorModel);
log.d("InApp didDismissForever ").writeLog();
}
@Override
public void onSuccess(InApp inapp) {
super.onSuccess(inapp);
log.d("InApp onSuccess ").writeLog();
}
@Override
public void didFormError(InApp inApp, ArrayList<InAppErrorModel> errorList) {
log.d("InApp didFormError: "+inApp.getSchema().getCode()).writeLog();
for (InAppErrorModel errorModel: errorList) {
log.d("With errorCode: " + errorModel.getErrorCode().getErrorId() + "\nError Message: " + errorModel.getErrorMessage().getErrorMessage() + "\nDescription: " + errorModel.getDescriptionMessage()).writeLog();
}
}
}
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.
If you want to close popup when it is clicked, you have to add on InApp configuration object, setClosePopupWhenClicked boolean param.
ConstraintLayout view = findViewById(R.id.myPopupParentLayout)
ImageButton myImageButton = ImageButton(context);
.
.//set ImageButton params
.
boolean closeIconDisabled = false
InAppConfiguration.Builder inAppConfig = new InAppConfiguration.Builder("YOUR_APP_KEY");
inAppConfig.setUrlInAppApi("https://device-api.indigitall.com/v2");
inAppConfig.setClosePopupWhenClicked = true;
inAppConfig.build();
InAppIndigitall.showPopUp(
inAppConfig,
view,
context,
"myPopup_CODE",
myImageButton,
closeIconDisabled,
new ShowInAppCallback() {
@Override
public void onLoad(String s, WebView webView) {
log.d("InApp Loaded ").writeLog();
}
@Override
public void onFail(String s, WebView webView, String s1) {
log.d("InApp onFail " + s1).writeLog();
}
@Override
public void onShowTimeFinished(String s, WebView webView, int i) {
log.d("InApp onShowTimeFinished ").writeLog();
}
@Override
public void didClicked(InApp inApp, InAppAction action) {
super.didClicked(inApp, action);
log.d("InApp didClicked ").writeLog();
}
@Override
public void didClosed() {
super.didClosed();
log.d("InApp didClosed ").writeLog();
}
@Override
public void didExpired(InApp inApp, InAppErrorModel errorModel) {
super.didExpired(inApp, errorModel);
log.d("InApp didExpired ").writeLog();
}
@Override
public void didClickOut(InApp inApp, InAppErrorModel errorModel) {
super.didClickOut(inApp, errorModel);
log.d("InApp didClickOut " ).writeLog();
}
@Override
public void didShowManyTimes(InApp inApp, InAppErrorModel errorModel) {
super.didShowManyTimes(inApp, errorModel);
log.d("InApp didShowManyTimes ").writeLog();
}
@Override
public void didDismissed() {
super.didDismissed();
log.d("InApp didDismissed ").writeLog();
}
@Override
public void didDismissForever(InApp inApp, InAppErrorModel errorModel) {
super.didDismissForever(inApp, errorModel);
log.d("InApp didDismissForever ").writeLog();
}
@Override
public void onSuccess(InApp inapp) {
super.onSuccess(inapp);
log.d("InApp onSuccess ").writeLog();
}
@Override
public void didFormError(InApp inApp, ArrayList<InAppErrorModel> errorList) {
log.d("InApp didFormError: "+inApp.getSchema().getCode()).writeLog();
for (InAppErrorModel errorModel: errorList) {
log.d("With errorCode: " + errorModel.getErrorCode().getErrorId() + "\nError Message: " + errorModel.getErrorMessage().getErrorMessage() + "\nDescription: " + errorModel.getDescriptionMessage()).writeLog();
}
}
})