commit | author | age
|
96fe76
|
1 |
// |
L |
2 |
// GADAppOpenAd.h |
|
3 |
// Google Mobile Ads SDK |
|
4 |
// |
|
5 |
// Copyright 2020 Google LLC. All rights reserved. |
|
6 |
// |
|
7 |
|
|
8 |
#import <GoogleMobileAds/GADAdValue.h> |
|
9 |
#import <GoogleMobileAds/GADFullScreenContentDelegate.h> |
|
10 |
#import <GoogleMobileAds/GADRequest.h> |
|
11 |
#import <GoogleMobileAds/GADResponseInfo.h> |
|
12 |
#import <UIKit/UIKit.h> |
|
13 |
|
|
14 |
#pragma mark - App Open Ad |
|
15 |
|
|
16 |
@class GADAppOpenAd; |
|
17 |
|
|
18 |
/// The handler block to execute when the ad load operation completes. On failure, the |
|
19 |
/// appOpenAd is nil and the |error| is non-nil. On success, the appOpenAd is non-nil and the |
|
20 |
/// |error| is nil. |
|
21 |
typedef void (^GADAppOpenAdLoadCompletionHandler)(GADAppOpenAd *_Nullable appOpenAd, |
|
22 |
NSError *_Nullable error); |
|
23 |
|
|
24 |
/// An app open ad. Used to monetize app load screens. |
|
25 |
@interface GADAppOpenAd : NSObject <GADFullScreenPresentingAd> |
|
26 |
|
|
27 |
/// Loads an app open ad. |
|
28 |
/// |
|
29 |
/// @param adUnitID An ad unit ID created in the AdMob or Ad Manager UI. |
|
30 |
/// @param request An ad request object. If nil, a default ad request object is used. |
|
31 |
/// @param completionHandler A handler to execute when the load operation finishes or times out. |
|
32 |
+ (void)loadWithAdUnitID:(nonnull NSString *)adUnitID |
|
33 |
request:(nullable GADRequest *)request |
|
34 |
completionHandler:(nonnull GADAppOpenAdLoadCompletionHandler)completionHandler; |
|
35 |
|
|
36 |
/// Optional delegate object that receives notifications about presentation and dismissal of full |
|
37 |
/// screen content from this ad. Full screen content covers your application's content. The delegate |
|
38 |
/// may want to pause animations and time sensitive interactions. Set this delegate before |
|
39 |
/// presenting the ad. |
|
40 |
@property(nonatomic, weak, nullable) id<GADFullScreenContentDelegate> fullScreenContentDelegate; |
|
41 |
|
|
42 |
/// The ad unit ID. |
|
43 |
@property(nonatomic, readonly, nonnull) NSString *adUnitID; |
|
44 |
|
|
45 |
/// Information about the ad response that returned the ad. |
|
46 |
@property(nonatomic, readonly, nonnull) GADResponseInfo *responseInfo; |
|
47 |
|
|
48 |
/// Called when the ad is estimated to have earned money. Available for allowlisted accounts only. |
|
49 |
@property(nonatomic, nullable, copy) GADPaidEventHandler paidEventHandler; |
|
50 |
|
|
51 |
/// Returns whether the app open ad can be presented from the provided root view controller. Sets |
|
52 |
/// the error out parameter if the app open ad can't be presented. Must be called on the main |
|
53 |
/// thread. If rootViewController is nil, uses the top view controller of the application's main |
|
54 |
/// window. |
|
55 |
- (BOOL)canPresentFromRootViewController:(nullable UIViewController *)rootViewController |
|
56 |
error:(NSError *_Nullable __autoreleasing *_Nullable)error; |
|
57 |
|
|
58 |
/// Presents the app open ad with the provided view controller. Must be called on the main thread. |
|
59 |
/// If rootViewController is nil, attempts to present from the top view controller of the |
|
60 |
/// application's main window. |
|
61 |
- (void)presentFromRootViewController:(nullable UIViewController *)rootViewController; |
|
62 |
|
|
63 |
@end |