Xamarin Plugin

Supported platforms:

  • iOS

The plugin features include:

  • Support for Banner Ads
  • Support for Interstitial Ads
  • Banner positions(top/bottom)
  • Banner ad events listeners
  • A sample project to demonstrate plugin integration

And the requirements are:

  • Xamarin/Visual Studio
  • Zone id (click here to create one).
  • Deployment target of iOS 6.0 or higher

Adcash provides two different APIs:

  1. iOS binding API(AdcashSDK.iOS)
  2. C#-friendly API(AdcashSDK.Api) on top of the iOS API

Note: The iOS binding API would be a better choice if you need to make fine-tunings.


  1. You can choose to use the iOS binding API in an iOS-only project and explicitly specify a parent view for your banner:
        using AdcashSDK.iOS;
        using CoreGraphics;
        using Foundation;
        const string zoneID = "<Get your zone ID at www.adcash.com";
        public override void ViewDidLoad ()
        	base.ViewDidLoad ();
        	ACBannerView banner = new ACBannerView (ACAdSize.ACAdSizeSmartBanner, zoneID, this);
        	banner.WeakDelegate = this;
        	this.View.AddSubview(banner); // Banner is of type ACBannerView, which is subclass of UIView
        	// Place the banner at the bottom of the view
        	banner.Frame = new CGRect (0, this.View.Frame.Size.Height - banner.Frame.Size.Height, this.View.Frame.Size.Width, banner.Frame.Size.Height);
        	// Autoresize the view when rotating the device
        	banner.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | 
        							  UIViewAutoresizing.FlexibleTopMargin | 
        							  UIViewAutoresizing.FlexibleLeftMargin | 
        	banner.Load ();
        //bind to the Objective-C selector bannerViewDidReceiveAd:
        public void BannerViewDidReceiveAd (ACBannerView bannerView)
            Console.WriteLine("Adcash: Banner loaded successfully.");

  2. Alternatively, you can display a banner in your view controller with the Adcash C#-friendly API:

        using AdcashSDK.API;
        const string zoneID = "<Get your zone ID at www.adcash.com";
        public override void ViewDidLoad ()
        	base.ViewDidLoad ();
        	BannerView bannerView = new BannerView (zoneID, AdPosition.Bottom);
        	bannerView.LoadAd ();
        	bannerView.AdLoaded += (object sender, EventArgs e) => {
        		Console.WriteLine("Loading banner");
        	bannerView.AdFailedToLoad += (object sender, AdFailedToLoadEventArgs e) => {
        		Console.WriteLine("Failed to load banner");

    When using the C#-friendly API you do not need to specify the parent view for the banner. Instead, the banner will be added to the top-most view of the view controller.


  1. You can use the iOS binding API API to show an interstitial:

        using AdcashSDK.iOS;
        using Foundation;
        const string zoneID = "<Get your zone ID at www.adcash.com";
        private ACInterstitial interstitial;
        public override void ViewDidLoad ()
        	base.ViewDidLoad ();
        	this.interstitial = new ACInterstitial (zoneID);
        	this.interstitial.WeakDelegate = this;
        	this.interstitial.Load ();
        public void InterstitialDidReceiveAd (ACInterstitial interstitial)
        	// Interstitial must be told to present explicitly when loaded
        	Console.WriteLine("Interstitial loaded successfully");

  2. And here is how you can show an interstitial with the C#-friendly API:

        using AdcashSDK.Api;
        const string zoneID = "<Get your zone ID at www.adcash.com";
        private Interstitial interstitial;
        public override void ViewDidLoad ()
        	base.ViewDidLoad ();
        	this.interstitial = new Interstitial (zoneID);
        	this.interstitial.LoadAd ();
        	this.interstitial.AdLoaded += (object sender, EventArgs e) => {
        		// Interstitials must be told explicitly to show after they've been loaded
        		interstitial.Show ();
        	this.interstitial.AdFailedToLoad += (object sender, AdFailedToLoadEventArgs e) => {
        		Console.WriteLine("failed to load interstitial");

Ad Events

Note: The following example is only applicable with the C#-friendly API.

Both BannerView and Interstitial classes contain the same ad events that you can
register for. These events are of type
Here is an example of how to register ad events on a banner:

using AdcashSDK;

BannerView bannerView = new BannerView("YOUR_AD_UNIT_ID", AdPosition.Top);

// Called when an ad request has successfully loaded.
bannerView.AdLoaded += HandleAdLoaded;
// Called when an ad request failed to load.
bannerView.AdFailedToLoad += HandleAdFailedToLoad;
// Called when an ad is clicked.
bannerView.AdOpened += HandleAdOpened;
// Called when the user is about to return to the app after an ad click.
bannerView.AdClosing += HandleAdClosing;
// Called when the user returned from the app after an ad click.
bannerView.AdClosed += HandleAdClosed;
// Called when the ad click caused the user to leave the application.
bannerView.AdLeftApplication += HandleAdLeftApplication;

public void HandleAdLoaded(object sender, EventArgs args)
    print("HandleAdLoaded event received.");
    // Handle the ad loaded event.

The only event with special event arguments is AdFailedToLoad. It passes an
instance of AdFailedToLoadEventArgs with a Message describing the error:

public void HandleAdFailedToLoad(object sender, AdFailedToLoadEventArgs args)
  print("Interstitial Failed to load: " + args.Message);
  // Handle the ad failed to load event.

You only have to register for the events you need to use.

Sample project

You will find a sample project in the component archive where you can also see in details how to integrate the Adcash SDK into your application.


If you need any support or assistance you can contact us by sending email to mobile@adcash.com.