GADInterstitial.h 3.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. //
  2. // GADInterstitial.h
  3. // Google AdMob Ads SDK
  4. //
  5. // Copyright 2011 Google Inc. All rights reserved.
  6. //
  7. #import <UIKit/UIKit.h>
  8. #import "GADInAppPurchaseDelegate.h"
  9. #import "GADInterstitialDelegate.h"
  10. #import "GADModules.h"
  11. #import "GADRequest.h"
  12. #import "GADRequestError.h"
  13. /// An interstitial ad. This is a full-screen advertisement shown at natural transition points in
  14. /// your application such as between game levels or news stories.
  15. ///
  16. /// Interstitials are shown sparingly. Expect low to no fill.
  17. @interface GADInterstitial : NSObject
  18. #pragma mark Pre-Request
  19. /// Required value created in the AdSense website. Create a new ad unit for every unique placement
  20. /// of an ad in your application. Set this to the ID assigned for this placement. Ad units are
  21. /// important for targeting and stats.
  22. /// Example values for different request types:
  23. /// AdMob: a0123456789ABCD
  24. /// DFP: /0123/ca-pub-0123456789012345/my-ad-identifier
  25. /// AdSense: ca-mb-app-pub-0123456789012345/my-ad-identifier
  26. @property(nonatomic, copy) NSString *adUnitID;
  27. /// Optional delegate object that receives state change notifications from this GADInterstitalAd.
  28. /// Remember to nil the delegate before deallocating this object.
  29. @property(nonatomic, weak) id<GADInterstitialDelegate> delegate;
  30. /// Optional delegate object that receives In-App Purchase (IAP) notifications from this
  31. /// GADInterstital ad. Remember to nil the delegate before deallocating this object.
  32. @property(nonatomic, weak) id<GADInAppPurchaseDelegate> inAppPurchaseDelegate;
  33. #pragma mark Making an Ad Request
  34. /// Makes an interstitial ad request. Additional targeting options can be supplied with a request
  35. /// object. Only one interstitial request is allowed at a time.
  36. ///
  37. /// This is best to do several seconds before the interstitial is needed to preload its content.
  38. /// Then when transitioning between view controllers show the interstital with
  39. /// presentFromViewController.
  40. - (void)loadRequest:(GADRequest *)request;
  41. #pragma mark Request at Application Launch
  42. /// The |window| will be shown with the |image| displayed until either the |request| interstitial is
  43. /// shown or a timeout occurs. The delegate will receive an interstitialDidDismissScreen: callback
  44. /// to indicate that your app should continue when the interstitial has finished.
  45. - (void)loadAndDisplayRequest:(GADRequest *)request
  46. usingWindow:(UIWindow *)window
  47. initialImage:(UIImage *)image;
  48. #pragma mark Post-Request
  49. /// Returns YES if the interstitial is ready to be displayed. The delegate's
  50. /// interstitialAdDidReceiveAd: will be called when this switches from NO to YES.
  51. @property(nonatomic, readonly, assign) BOOL isReady;
  52. /// Returns YES if the interstitial object has already shown an interstitial. Note that an
  53. /// interstitial object can only be used once even with different requests.
  54. @property(nonatomic, readonly, assign) BOOL hasBeenUsed;
  55. /// Returns the ad network class name that fetched the current ad. Returns nil while the latest ad
  56. /// request is in progress or if the latest ad request failed. For both standard and mediated Google
  57. /// AdMob ads, this method returns @"GADMAdapterGoogleAdMobAds". For ads fetched via mediation
  58. /// custom events, this method returns @"GADMAdapterCustomEvents".
  59. @property(nonatomic, readonly, copy) NSString *adNetworkClassName;
  60. /// Presents the interstitial ad which takes over the entire screen until the user dismisses it.
  61. /// This has no effect unless isReady returns YES and/or the delegate's interstitialDidReceiveAd:
  62. /// has been received.
  63. ///
  64. /// Set rootViewController to the current view controller at the time this method is called. If your
  65. /// application does not use view controllers pass in nil and your views will be removed from the
  66. /// window to show the interstitial and restored when done. After the interstitial has been removed,
  67. /// the delegate's interstitialDidDismissScreen: will be called.
  68. - (void)presentFromRootViewController:(UIViewController *)rootViewController;
  69. @end