English subtitles

← Implementing an Interstitial Ad

Get Embed Code
5 Languages

Showing Revision 3 created 05/25/2016 by Udacity Robot.

  1. Okay, so now you're well on your
    way to use ads in your app.
  2. And the time has come to implement,
    an interstitial ad.
  3. So to implement the interstitial,
    here's what we'll do.
  4. We will implement the interstitial
    activity that will contain two buttons
  5. for the initial text, Load Interstitial
    and Interstitial Not Ready.
  6. The Load Interstitial button
    will have a call back method
  7. called loadInterstitial.
  8. When this method is called,
    we will disable the button and
  9. then change the takes to
    Loading Interstitial.
  10. The other button will have
    a property in interstitial activity
  11. called mShowButton.
  12. It's callback method
    will be showInterstitial.
  13. And for the first part of this we
    will leave that implementation empty.
  14. As you can see, when the activity
    is loaded, this button is disabled.
  15. Therefore, we will set it
    to disabled in onCreate.
  16. And finally for this first step,
    we will create a string
  17. resource called interstitial_ad_unit_id.
  18. This string resource we will
    set to the following value.
  19. And as you may have guessed, this is the
    test ad unit ID for interstitial ads.
  20. So let's look in more detail how
    these things are implemented.