AdMob, Google Mobile Ad, switching from iAd, bannerView - ios

iOS 9.3, Xcode 7.3, ARC enabled.
I am migrating away from iAd, and I have some general questions regarding best design patterns and how to properly use the Google Mobile Ads framework for banner style ads.
How do you control presentation on ad load and load failure?
My typical approach is to start with the banner view hidden, detect when the ad is loaded, then either animate the banner view in from the top or bottom, or fade in from a stand-in image.
I noticed that GADBannerView class, does not have some of the more convenient properties of an iAd banner, such as isLoaded.
a) Right now I take advantage of the two methods - (void)adViewDidReceiveAd:(GADBannerView *)bannerView and - (void)adView:(GADBannerView *)bannerView didFailToReceiveAdWithError:(GADRequestError *)error, set an instance variable bool for the view controller when either method gets a message, then use that variable for any additional UI changes else where. Is this a good design practice?
b) "deleted", animation works.
c) When the ad fails to load, what happens to the banner view? I notice that its alpha property is still 1.0 and that it is not hidden. In a production environment when an AdMob ad fails to load, is the banner clear? Or does it have a generic stand-in image? In other words, am I going to have to slide in an image to balance the view without the banner view there?
I've read from the basic AdMob tutorial that it doesn't really matter where the banner is, it can be in multiple view controllers, the framework will manage how these multiple banners will be filled. Could someone confirm this behavior? Say, I have two view controllers and I have two different banner views, I don't have to manage the ads? All I have to do is provide the banner view real estate?
Generally speaking, if I used to have iAd for ads and also in-app. purchases through iTunes, then what is the modern day trend? Am I supposed to have ads through AdMob and keep in-app. purchases as they are through Apple? Is that what people are doing now?
Thanks in advance for your answers. I know this maybe too general, but I really want some sort of a fundamental understanding where to head, before I submit anything to Apple.
--
Here is the code for animation I am using:
- (void)adViewDidReceiveAd:(GADBannerView *)bannerView
{
bannerDidLoad = true;
[UIView animateWithDuration:1.0 animations:^{
bannerView.alpha = 1.0;
bannerView.frame = CGRectMake(bannerView.frame.origin.x, bannerView.frame.size.height, bannerView.frame.size.width, bannerView.frame.size.height);
} completion:^(BOOL finished) {
nil;
}];
}

You should really narrow your question down. It's kind of vague. Anyways, yes GADBannerView's will be clear if they fail to receive an ad. Using the delegate methods to know what state the GADBannerView is in is the standard. Animating the alpha property should not be an issue. Not really sure what that last question is asking. You can use any ad network you'd like. If you're using in app purchases already just continue using them and remove the GADBannerView instead of the ADBannerView.

Related

How to stop showing AdMob banner ad correctly?

I am building an app which will display AdMob banner ad, and when user successfully purchased an IAP item, the banner ad will never show up again, and the screen area originally occupied by the banner ad will be used by the app real functions.
The question is how to dismiss the bannerView or does not init it on the next launch up? And how to insure AdMob Sdk will never refresh the ad content in the background?
I think we cannot just hide the bannerView with just a statement:
bannerView.isHidden = true
And, as we know, AdMob SDK use IDFA. But Apple will deny an app which use IDFA but not showing Ads.
Google has guides on how to show up ads, but I cannot find information about how to stop showing ads from Google.
How to get this problem out?
The question is how to dismiss the bannerView or does not init it on
the next launch up? And how to insure AdMob Sdk will never refresh the
ad content in the background?
There are multiple ways to do this. One way I can think of is to add multiple targets in your Xcode project.
And the easier way, the more practical way - at least for me, is to prevent the requests for ads through GADRequest().
You can even do this even in AppDelegate, when setting Ids to your SDK.
That's it. You may also set nil to the delegate property of your bannerView.
And like what you've mentioned, just hide the bannerView's container, and everything should be perfect. I've worked on lots of applications with Admob, and I believe there should be no problem doing this approach.

Receiving Delegate Methods for iAd Banners iOS 7

In iOS 7, ADBannerView no longer needs to be created manually. Instead, they can be requested with a simple self.canDisplayBannerAds = YES;
Now, I cannot set my View Controller as the banner delegate because there is no banner for me to access (to my knowledge).
I need to know when the banner is tapped and when that action is dismissed so I can properly pause/start my Sprite Kit game.
How am I supposed to have these delegate methods called so I can properly respond to the user's actions?
AFAIK, there is nothing in the UIView Controller iAD Additions that explains how to set the delegate for the banners.
Do I need to create the banners manually, or is there a way to achieve this while still using the newer API's?
Unfortunately, if you want to use the delegate methods, you will need to set up your iAd Banner manually. Even if you make your vc the delegate, by just using self.canDisplayBannerAds = YES, will not call the methods you need. In my sprite kit game, I made all the banners manually so I could take care of pausing the game and going to the background. Making them give you the control you are looking for. Good luck.

Is it allowed to hide iAds even when they are available?

I need to hide iAds depending on certain conditions, regardless their availability. So, I was wondering if my app would be rejected in the case where I hide the iAd, even when there's an iAd being displayed.
iAds will not work if their alpha is set to anything other than 1, so you could simply use this code to turn them off:
ADBannerView *banner;
[banner setAlpha:0];
This is how you would remove ads in apps, too, so your app will not get rejected for doing this - again, iAds do NOT display if the alpha is set to anything other than 1, so you can't hide an iAd and have it be displayed at the same time - pretty much, when you hide an iAd it is about the equivalent to the user not having any internet connection, and the iAd being hidden.

my iad is still being displayed when I change from one screen to the next

I have successfully implemented iAd into my App just this past week, but when my fill rate was very low I looked into it, and I realize I have a problem. My iAd banner is correclty displayed on the first screen the user sees, and that is the only screen on which the banner ad is displayed by my design. I setup a singleton class to manage the ads, and I'm expanding it to display on additional screens in an upcoming release. However, when I push another view controller to the front that doesn't display ads, my iAd delegate methods:
- (void)bannerViewDidLoadAd:(ADBannerView *)banner
- (void) bannerView:(ADBannerView *)banner didFailToReceiveAdWithError:(NSError *)error
are still being called every 3 minutes as though the view is active.
Is there a way to temporarily disable iAd from trying to refresh? thanks in advance.
Since I'm not showing ads on all of the pages, I create/release the ad object when my view controller that is showing ads is displayed/not-displayed (and set the delegate to nil), and this prevents any ads/delegate functions on view controllers that are not currently displayed from being displayed.

ads in universal app + ad persisting even when viewController changes

I'm implementing ads for the first time in an app that will be universal. I've followed a few tutorials and sorta|kinda have it working - using adWhirl, iAd, adMob. The tutorials were a bit simplistic though and I'm wondering if there are any open source universal ad template/library projects out there.
I've seen this and while helpful, the tutorial code is kind of broken/limited.
The specific questions I have (iOS5+ universal app):
In an app with a navController where the UIViewController can segue
multiple times to other controllers and then back again, do I need to
set up the ad stuff in each viewController or is there some way I
can have the ad layer/view persist across multiple VC views?
Ad sizes - In my test app, running on iPad I am getting ads but the
size is for iPhone. In adWhirl it didn't seem possible to specify
universal - only iPhone or Android. I've seen other iPad apps that seem to have a problem presenting ads because of the size - ads
appear in weird places, etc. Is there some universal solution to
the issue of ad sizes in universal apps?
For your first question, I would recommend that you use a singleton approach for your adView. You can find a similar singleton approach for an AdMob adView here. Tweaking that with your AdWhirl view instead shouldn't be bad at all. For each view that is displayed then, you could just do something like:
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
shared = [AdWhirlMasterViewController singleton];
[shared resetAdView:self];
}
For your second question, I wonder if you can't just make some minor modifications to your adapter code to get iPad ads to show. So, for example, for AdMob adapter's getAd: method, you'd probably have something that looks like:
if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) {
adSize = kGADAdSizeLeaderboard;
} else {
adSize = kGADAdSizeBanner;
}
Then create your GADBannerView doing something similar to:
GADBannerView *view =
[[GADBannerView alloc] initWithAdSize:adSize];

Resources