I use Google DFP (DoubleClick for Publishers) ads for Android and an iPhone device, I want to show ads on specific screen sizes for an app in ios and android in LANDSCAPE mode. I created an order, then I have created a position for this order and inside this position, I created "ads" of various sizes in accordance with the physical sizes of the screens for iOS and Android. Then I went into inventory and got ad tags for all ads and included them in my apps separated by size checks.
Now the problem is that in the code, although the tag is the correct ad, the ad (image) that I specified for this tag is randomly selected. This problem exists in both Android and iPhone.
I want to know why not only the specified ad size (image) was selected? Do I need to share the stocks of iPhone and Android (creatives)?
I also tried the sizes of smart banners and the sizes of banners the specified ad is not displayed.
ref smart banners: https://developers.google.com/mobile-ads-
SDK / documents / DFP / Android / banner # smart
ref custom banners: https://developers.google.com/mobile-ads-
SDK / Docs / DFP / Android / banner # custom_size
, , , . , , , . , .
Android iPhone:
Android. .
Fragment frag=new AdBannerFragment();
ArrayList<Integer> screenSize=Globals.getScreenSize
(getActivity());
Integer width=screenSize.get(0);
if (width==120) {
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-120dpi");
} else if (width==160) {
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-160dpi");
} else if (width==240) {
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-240dpi");
}
else if (width==320) {
("/235389899/Clubfitting_4-14_320x50");
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-320dpi");
} else if (width==480) {
("/235389899/Clubfitting_4-14_480x50");
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-480dpi");
} else if (width==640){
("/235389899/Clubfitting_4-14_640x100");
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-640dpi");
}else{
frag = new AdBannerFragment
("/235389899/Clubfitting-Update-15_320x50-640dpi");
}
AdBanner ( ):
AdSize customAdSize = new AdSize(AdSize.FULL_WIDTH, 50);
adView = new PublisherAdView(activity2);
adView.setAdSizes(customAdSize);
mAdContainer.addView(adView);
adView.setAdUnitId(mTag);
adView.loadAd(new PublisherAdRequest.Builder
().build());
iPhone. .
CGSize screenSize;
if (SYSTEM_VERSION_GREATER_THAN_OR_EQUAL_TO(@"8.0"))
{
screenSize = [UIScreen mainScreen].nativeBounds.size;
}
else
{
screenSize = [UIScreen mainScreen].bounds.size;
}
NSLog(@"screen size: %@ banner frame: %@",NSStringFromCGSize(screenSize),NSStringFromCGSize(self.bannerVw.frame.size));
if (screenSize.width== 1920)
{
self.bannerVw.adUnitID = @"/235389899/Clubfitting-Update-15_736x90";
self.bannerVw.adSize = GADAdSizeFromCGSize(CGSizeMake(736, 90));
}
else if (screenSize.width== 1334)
{
self.bannerVw.adUnitID = @"/235389899/Clubfitting-Update-15_667x50";
self.bannerVw.adSize = GADAdSizeFromCGSize(CGSizeMake(667, 50));
}
else if (screenSize.width== 1136)
{
self.bannerVw.adUnitID = @"/235389899/Clubfitting-Update-15_568x50";
self.bannerVw.adSize = GADAdSizeFromCGSize(CGSizeMake(568, 50));
}
else if (screenSize.width== 960)
{
self.bannerVw.adUnitID = @"/235389899/Clubfitting-Update-15_480x50";
self.bannerVw.adSize = GADAdSizeFromCGSize(CGSizeMake(480, 50));
}
else
{
self.bannerVw.adUnitID = @"/235389899/Clubfitting-Update-15_736x90";
self.bannerVw.adSize = GADAdSizeFromCGSize(CGSizeMake(736, 90));
}
AdBanner ( ):
self.bannerVw.rootViewController = self;
[self.bannerVw setDelegate:self];
GADRequest *request = [GADRequest request];
[self.bannerVw loadRequest:request];