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.
Define a hybridWeview in the .xml file. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to _inches.
//160 units is 1 inch. 64 units is 1 cm
<local:HybridWebView x:Name="hybridWebView" InAppId="Billboard" WidthRequest="x" HeightRequest="y"/>
First at all, you have to instantiate IndigitallInApp to call to the proper methods:
Com.Indigitall.Xamarin.iOS.InApp.IndigitallInApp indigitallInApp = new Com.Indigitall.Xamarin.iOS.InApp.IndigitallInApp();
Instantiate In-App messages using the ShowInApp method.
IInAppConfiguration inAppConfig = new IInAppConfiguration();
inAppConfig.appKey = "YOUR_APPKEY";
inAppConfig.urlInAppApi = "YOUR_INAPP_V2_URL";
inAppIndigitall.ShowInApp(inAppConfig, webViewHybrid, "INAPP_CODE", (inAppId, webview) =>
{
//DO SOMETHING
},(inAppId, webview, errorMessage)=>
{
//LOG ERROR
}, (inAppCode, webView) =>
{
//DidDismissed
});
Multiple Banner format- Android Xamarin Classics
Create a WebView view in your layouts. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to DP.
<android.webkit.WebView
android:id="@+id/myBanner"
android:layout_width="230dp"
android:layout_height="33.33dp"
/>
<android.webkit.WebView
android:id="@+id/otherBanner"
android:layout_width="250dp"
android:layout_height="36dp"
/>
Instantiate In-App messages using the ShowMultipleInApp method.
var myBanner = FindViewById<Android.Webkit.WebView>(Resource.Id.myBanner);
var otherBanner = FindViewById<Android.Webkit.WebView>(Resource.Id.otherBanner);
var views = new List<Android.Webkit.WebView>();
views.Add(myBanner);
views.Add(otherBanner);
var codes = new List<>();
codes.Add("myBanner_CODE");
codes.Add("otherBanner_CODE");
InAppConfiguration.Builder configuration = new InAppConfiguration.Builder("YOUR APPKEY);
configuration.SetUrlInAppApi("YOUR_INAPP_V2_URL");
InAppIndigitall.ShowMultipleInApp(getContext(), configuration.Build(), codes, views, new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
@Override
public void didDismissed(String inAppCode, WebView webView) {
super.didDismissed(inAppCode,webView);
Log.d("InApp didDismissed " + inAppCode);
}
});
Banner format - iOS Xamarin Classics
Create a WebView view on the storyBoard. The size must match what you defined in the indigitall console ( Tools > In-App / In-Web Schemas ). Remember to translate the units from PX to iOS points.
Instantiate In-App messages using the method, whether you want to show one inapp or several of them.
IndigitallInAppXamarin.InAppIndigitall.ShowInApp(uiWebviewIos, "Billboard", (inAppId, webView) =>
{
// DO SOMETHING
}, (inAppId, webView, message) =>
{
// DO SOMETHING
},()=>{
//DidDismissed: DO SOMETHING
});
var views = new List<UIView>();
views.Add(myBanner);
views.Add(otherBanner);
var codes = new List<>();
codes.Add("myBanner_CODE");
codes.Add("otherBanner_CODE");
IndigitallInAppXamarin.InAppIndigitall.ShowMultipleInApp(views, codes, (inAppId, webView) =>
{
// DO SOMETHING
}, (inAppId, webView, message) =>
{
// DO SOMETHING
}, (inApp, webView) =>{
//DidDismissed: DO SOMETHING
});
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.
Instantiate the In-App messages from the hybridWebView using the ShowPopUp method.
If you want to close popup when it is clicked, you have to add on InApp configuration object, setClosePopupWhenClicked boolean param.
indigitallInApp.ShowPopUp(view, "INAPP_CODE", (inAppId, webview) =>
{
//DO SOMETHING
},(inAppId, webview, errorMessage)=>
{
//LOG ERROR
}, () =>
{
Console.WriteLine("DidClick");
}, () =>
{
Console.WriteLine("DidClose");
}, () =>
{
Console.WriteLine("DidDismissed");
});
//In the event that you want to customize the close icon of the Popup,
//you can use the following method, in which you add a custom UIButton, or use the ** closeIconDisabled ** variable to show none:
IInAppConfiguration inAppConfig = new IInAppConfiguration();
inAppConfig.appKey = "YOUR_APPKEY";
inAppConfig.urlInAppApi = "YOUR_INAPP_V2_URL";
inAppConfig.ClosePopupWenClicked = true;
indigitallInApp.ShowPopUp(inAppConfig, view, "INAPP_CODE", myIcon, false, (inAppId, webview) =>
{
//DO SOMETHING
},(inAppId, webview, errorMessage)=>
{
//LOG ERROR
}, () =>
{
Console.WriteLine("DidClick");
}, () =>
{
Console.WriteLine("DidClose");
}, () =>
{
Console.WriteLine("DidDismissed");
});
Popup format - Android Xamarin Classics
Create a WebView view in your layouts. The size must match what you have defined in the indigitall console ( Tools> In-App / In-Web Schemas ). Remember to translate the units from PX to DP.
var view = findViewById(R.id.myPopup)
IndigitallInApp.ShowPopUp(view, getContext(), "myPopup_CODE", new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
});
//In the event that you want to customize the close icon of the Popup, you can
//use the following method, in which you add a custom UIButton, or use the ** closeIconDisabled ** variable to show none:
IndigitallInApp.ShowPopUp(view, getContext(), "myPopup_CODE", myIcon, false, new ShowInAppCallback() {
@Override
public void onLoad(String inAppCode, WebView webView) {
Log.d("In-App loaded: ", inAppCode);
}
@Override
public void onFail(String inAppCode, WebView webView, String message) {}
});
Popup format - iOS Xamarin Classics
Create a WebView view on the storyBoard. The size must match what you defined in the indigitall console ( Tools > In-App / In-Web Schemas ). Remember to translate the units from PX to iOS points.
IndigitallInAppXamarin.InAppIndigitall.ShowPopup("myPopup_CODE", () =>
{
// DO SOMETHING didAppear
}, () =>
{
// DO SOMETHING didCancel
}, () =>
{
// DO SOMETHING didClicked
},(error)=> {
//Log Error
});
//In the event that you want to customize the close icon of the Popup,
//you can use the following method, in which you add a custom UIButton, or use the ** closeIconDisabled ** variable to show none:
IndigitallInAppXamarin.InAppIndigitall.ShowPopup("myPopup_CODE", myIcon, false, () =>
{
// DO SOMETHING didAppear
}, () =>
{
// DO SOMETHING didCancel
}, () =>
{
// DO SOMETHING didClicked
},(error)=> {
//Log Error
});