Interstitial ads in

CastielTR 141 Reputation points

I need to help how to entegry Int ad to my project. I have allready a banner ad but I cant add Int ad. I have few errors.
The error is :"Unable to instantiate abstract type or interface 'InterstitialAd"
The error code:"CS0144"

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,314 questions
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,512 questions
0 comments No comments
{count} votes

Accepted answer
  1. Leon Lu (Shanghai Wicresoft Co,.Ltd.) 70,961 Reputation points Microsoft Vendor


    Welcome to our Microsoft Q&A platform!

    Because InterstitialAd is an abstract class, so we cannot new InterstitialAd() directly, we could create a new class to extend the InterstitialAd like following code.


    To achieve override method.

       public class MyInterstitialAd : InterstitialAd  
               private Context context;  
               public MyInterstitialAd(Context context)  
                   this.context = context;  
               public override string AdUnitId => throw new System.NotImplementedException();  
               public override FullScreenContentCallback FullScreenContentCallback { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }  
               public override IOnPaidEventListener OnPaidEventListener { get => throw new System.NotImplementedException(); set => throw new System.NotImplementedException(); }  
               public override ResponseInfo ResponseInfo => throw new System.NotImplementedException();  
               public override void SetImmersiveMode(bool p0)  
                   throw new System.NotImplementedException();  
               public override void Show(Activity p0)  
                   throw new System.NotImplementedException();  

    Best Regards,

    Leon Lu

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    1 person found this answer helpful.
    0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Christopher Drosos 1 Reputation point

    Hello, thanks for this post, im trying too to create a new InterstitialAd from my old code. although i would need some help. i understand that from now on we have to override the method but how exactly we should do that?
    for example in the previous google ads version where override was not needed in order to show an add we have to do

    FullScreenAd = new InterstitialAd(this);
    FullScreenAd.AdUnitId = GetString(Resource.String.FullScreen_InterstitialDd_UunitId);
    FullScreenAd.AdListener = new AdListener(this);
    var adRequest = new AdRequest.Builder().Build();

    i cant exactly understand how i can now load and show ads and also here the sample is not updated,