recently I have decided to ad google admob banners to the game. I have followed every step by the guide and added our ad-unit-id too. So everything is ok and cool, but suddenly the banner becomes larger and is showing video at about thrice (or even bigger) the size of the banner itself.
I'm using unity 2020.1.13 and I have tested different banner sizes as admob guide suggesting (SmartBanner, AdaptiveBanner, (default small) Banner ,... ) everything. but it keeps punching me in the face each time. The following images are the normal size(which I expect it to remain) and the larger version that happens 2-3 times out of 10.
Normal size
After loaded video size
The code requesting the banner is:
public void RequestBanner(string unitID)
{
// Clean up banner ad before creating a new one.
if (this.bannerViewAd != null)
{
Debug.Log("|||| Prev Banner removed!");
this.bannerViewAd.Destroy();
}
AdSize adaptiveSize =
AdSize.GetPortraitAnchoredAdaptiveBannerAdSizeWithWidth(AdSize.FullWidth);
// Create a 320x50 banner at the top of the screen.
this.bannerViewAd = new BannerView(unitID, adaptiveSize, AdPosition.Bottom);
// Called when an ad request has successfully loaded.
this.bannerViewAd.OnAdLoaded += this.HandleOnAdLoaded;
// Called when an ad request failed to load.
this.bannerViewAd.OnAdFailedToLoad += this.HandleOnAdFailedToLoad;
// Called when an ad is clicked.
this.bannerViewAd.OnAdOpening += this.HandleOnAdOpened;
// Called when the user returned from the app after an ad click.
this.bannerViewAd.OnAdClosed += this.HandleOnAdClosed;
// Called when the ad click caused the user to leave the application.
this.bannerViewAd.OnAdLeavingApplication += this.HandleOnAdLeavingApplication;
// Create an empty ad request.
AdRequest adRequest = new AdRequest.Builder().Build();
// Load the banner with the request.
this.bannerViewAd.LoadAd(adRequest);
}
in the code u are seeing adaptivesize and constantSize , I tested both and came up with the same result, also I tested smart banner and same result too.
Until now I could not find any solution for this, even after contacting admob support they refused to answer me.
So for you guys using admob banner ads, seems like you mustn't use video banner
Related
How and where do I implement the code to set my test device ID for Admob in Flutter apart from setting it in my ADMOB UI? This line "Use RequestConfiguration.Builder().setTestDeviceIds(Arrays.asList("myTestDeviceId"))" keeps popping
Add
RequestConfiguration configuration =
RequestConfiguration(testDeviceIds: ["ID HERE"]);
And
MobileAds.instance.updateRequestConfiguration(configuration)
To your main function after mobileads.instance.initialize();
Next to the message you mentioned would be your device id ..
No need to add it in the admob setting after this
And then use actual ad units afterwards
Once the AdMob banner is displayed, it blinks the screen knowing that there is no error reporting in the console!
The screen viewing the ad includes a spinner that runs until some data are fetched from an API, so I kept the spinner loading until the Ad is present to avoid blinking, but the screen still blinks when Ad is shown.
This is a sample from my code:
this.admobFree.banner.config(ConfigData.bannerAds.config);
// autoShow = true in config.
this.admobFree.banner.prepare().then(()=>{
// Boolean variable that is assigned to the *ngIf directive to keep the spinner until the
// banner is loaded.
// <ion-spinner name="crescent" *ngIf="!isDataLoaded&&!(isBannerLoaded)"></ion-spinner>
isBannerLoaded=true;
});
What is causing the screen blink when a banner is viewed? And how to solve this?!
(ionic 4)
It seems that it is a fault in the ionic AdMob plugin where this issue is reported on the ionic forum without proposed solutions!
https://forum.ionicframework.com/t/admob-screen-flash-on-load/25526
I had solved this by waiting for the AdMob banner to be shown and then display my actual view where this is controlled by using the *ngIf directive and a Boolean variable like this:
isContentVisible: boolean=false;
....
this.admobFree.banner.show().then(()=>{
this.isContentVisible=true;
});
This will decrease the blink by 95%, but it may take some seconds to display if the internet connection is weak!
By the way the blink is slight, and will not be a clearly noticed issue, but to be professional it must be solved!
Hope the the ionic AdMob developers will solve that!
I am currently editing my code as following:
Admob ad;
ad.initAdmob("admob banner id", "admob interstitial id");
My question is that I don't know the difference between admob banner id and admob interstitial id,(by the way, my English is not very good)
When you click the create add section the first kind of add is banner and the second kind of add is interstellar.
Well this is not English too but you can see the places from these images.
After you create your adds you can look their id from your created adds
You can see add id from here, while you are creating your add give them a name inculude their type so you can find it later on here.
Initialize Admob Unity Plugin
Admob.Instance().initAdmob("admob banner id", "admob interstitial id");
Admob id with format ca-app-pub-279xxxxxxxx/xxxxxxxx
Required two id one for banner and another for interstitial Ads.
Register your app in the AdMob UI and create your own ad unit IDs for banner and interstitial.
My CodenameOne app works perfectly when using the android.googleAdUnitId or ios.googleAdUnitId build hints in order to show the Admob Ads banner at the bottom. However, I would like to give some coins/diamonds as rewards when users click on the bottom Ads banner. How can I do this? Is it possible for the main class to handle this by implementing the AdsListener interface like the https://github.com/chen-fishbein/admobfullscreen-codenameone supports (or at least the main class should implement a special interface which has the onAdLeftApplication() function only?)
Shai, Chen, anyone, do you have any advice?
There is no way to adjust the banner behavior, if you want to reward the user use full screen ads, there are quite a few full screen ads providers with a CodenameOne integration see these:
https://github.com/chen-fishbein/flurry-codenameone , https://github.com/chen-fishbein/startapp-codenameone , https://github.com/amiga/aerserv-codenameone
i try to run the downloaded code from admob, but that not shows adbanner in screen, even i uses publisher id in pice of code.
bannerView_.adUnitID = MY_BANNER_UNIT_ID;
Please answer.
Enable test ads to check whether the problem is with your code or with AdMob:
GADRequest.isTesting = YES;
Do what jnic suggests. Also, check if there is a message from AdMob in the console. There might be a message that says not showing ads is normal.