I have an iOS app with a button that (when tapped) plays rewarded video ads one after the other. The first times its tapped it plays ads from ad network 1, the second time its tapped it plays ads from ad network 2, and so on.
I want to add an alert that appears when the button is tapped asking the user if he/she are sure they want to play the video - if yes then the video plays, if no then the alert disappears.
Here is the code I currently have:
- (IBAction)freeTenCoins:(id)sender
{
// Try AppLovin.
if ([ALIncentivizedInterstitialAd isReadyForDisplay]) {
NSLog(#"Trying AppLovin");
[ALIncentivizedInterstitialAd show];
[Coins instance].coins += 10;
// Try LeadBolt.
} else {
NSLog(#"Trying LeadBolt");
[AppTracker loadModule:#"video" viewController:self];
}
Can anyone here show me how to show this alert? Any help would be much appreciated.
Actually, the AppLovin SDK has this feature built in.
All you need to do is go to the Manage Applications page, scroll down to the Rewarded Section and turn "Pre-video Modal" to on. We'll show an alert asking if they'd like to view the video, and then act on that. If they choose yes, we'll show an ad on your behalf; if they choose no, we'll notify you via the optional delegate method userDeclinedToViewAd: in ALAdRewardDelegate.
Of course you can also implement this feature yourself using UIAlertController or UIAlertView. This is actually what we do internally in the SDK anyway. This question elaborates more on that subject.
Related
My code is in swift 4,
As follows, it shows me Ads like, as shown in the 1st picture.
var rewardBasedVideo: GADRewardBasedVideoAd!
rewardBasedVideo = GADRewardBasedVideoAd.sharedInstance()
rewardBasedVideo.delegate = self
rewardBasedVideo.load(GADRequest(),
withAdUnitID: GOOGLE_AD_UNIT_ID)
But I want to enable close Ad close button after some time. Or I want to show "Skip Ad" button instead of a close button
I have also implemented the same and I do not think that there is a way around in the reward-based video ad. You can find other ad modules and they will provide the Skip Ad thing. But, in the reward-based video, you can not skip.
If you close it then the reward will not be paid. Sometimes, these are small, but sometimes up to a minute. There is no other way as of now.
We can see ads with skip after time feature in Google AdMob. But cannot achieve that programmatically. Maybe it is dependent on the creator of Ad.
Here is the code which presents reward based video on any view controller:
GADRewardBasedVideoAd.sharedInstance().present(fromRootViewController: vc)
Its successfully shows the video, but when the app enters background and comes to foreground, the ad dismisses itself and rewardBasedVideoAdDidClose fires.
Is it normal behaviour?
Yes, this is intended behavior.
It's there to prevent getting rewards for a video the user is not even watching.
For more information, check out the documentation of GADRewardBasedVideoAd.
In my Swift iOS game I have a button that I show after the player loses, this button shows a rewarded ad from Chartboost.
The problem is that sometimes, i get an error on ad retrieval (error code 6) which is "No Ad Available". So i'm running out of ads for my region, i don't know why. Sometimes i'm able to watch 2-3 ads and that's all i can watch per day.
So when im running out of ads, the button still stays there of course, but does nothing. It might be confusing for the users to press the button and not see anything happening.
So i wanted to check if there are ads available, just hide the button.
The method i'm using to check if there is an ad available is:
Chartboost.hasRewardedVideo(CBLocationDefault)
But this somehow, is returning always false, no matter what CBLocation I use.
And I trigger the showAd() like this:
Chartboost.showRewardedVideo(CBLocationDefault)
Any suggestion?
Thanks.
What region are you currently located in? Chartboost might have some trouble filling ad requests if you happen to be located in a country like Pakistan or Thailand. It may be a simple case of not having enough advertisers in your area that meet your publishing criteria.
Also, are you trying to show an ad right away on your application's bootup or is it ingame somewhere?
When an iAd banner is clicked, and the interactive ad doesn't leave the app, are ads still received by the app while the full screen ad is displayed? Or is receiving new ads suspended at this time?
It doesn't say either way in Apple's docs.
I ask because I want to give the app every chance to optimize the CTR (click-through rate), so I'm wondering if I should stop ads manually like this:
- (BOOL)bannerViewActionShouldBegin:(ADBannerView *)banner
willLeaveApplication:(BOOL)willLeave {
if(!willLeave) {
[self destroyAdBanner]; // to stop receiving new ads
}
}
- (void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[self createAdBanner]; // start receiving new ads again if not already
}
What is the official approach? An Apple reference would be greatly appreciated.
There is no official documentation that I can find, but from repeated trials after an ad banner is clicked and the full-screen ad appears and waiting for long periods of time, there are no further calls to any of the ad delegate methods until the user interaction terminates. It looks like no new ads are fetched while in user interaction mode.
I own a simple soundboard app, which basically plays a song when a button is pushed.
I wanted to know, if it was possible to show an ad after a certain amount of user interactions.
e.g when 20 sounds have been played, a fullscreen ad would pop-up.
I've integrated RevMob in to my app, if that makes any differences :)
Thanks!
As far as I know, with any ad provider (including RevMob), you have pretty decent control on when an ad should appear.
For RevMob, I see you can call "[[RevMobAds session] showFullscreen];" when you want to show a full screen ad (or RevMobAds.session().showFullscreen(); if you're using Swift -- you didn't specify).
So just add a counter property in your view controller and increment the number of user interactions you want to keep track of and then show the full screen ad when you're ready.