question

pitup3 avatar image
pitup3 asked

ad auto size issue

i am Programmatically creating the AmazonAdLayout as mentioned in https://developer.amazon.com/sdk/mobileads/quick-start.html given my app key, in oncreate() { AdRegistration.setAppKey(APP_KEY); // Programmatically create the AmazonAdLayout // this.adView = new AdLayout(this); this.adView = new AdLayout(this, AdSize.SIZE_1024x50); // Set the correct width and height of the ad. LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams( LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT); adrel.addView(this.adView,lp); loadAdmob(); } public void loadAdmob() { Log.i("inside","loadAdmob"); this.adView.setTimeout(20000); //20 seconds this.adView.loadAd(new AdTargetingOptions()); // async task to retrieve an ad } my xml layout --> the ad layout is added to below layout in my main layout my issue is that the ad loads only once though i have settimeout(20000) value, it doesnt work, & one another issue , i have given AdSize.SIZE_1024x50 programatically, but the it takes full width of my kindle,but not with the height provided, because of that my design look ugly, it display smaller than the height provided, please sujjest what to do in such case
mobile ads
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Bipin@Amazon avatar image
Bipin@Amazon answered
1) An ad request call has a default timeout of 10 seconds. After the timeout threshold is exceeded the AdListener.onAdFailedToLoad event is called. The default timeout value can be changed using the AdLayout.setTimeout function, which takes milliseconds as an argument. To retrieve and display an ad, you will use an instance of AdLayout. You have to call inside your own timer logic. 2)AdSize.SIZE_1024x50 ad image will take the shape of the layout or container which you have used for the image Example: In your case use wrap_content
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

pitup3 avatar image
pitup3 answered
thnx bipin for your reply on my issue, i tried your suggestion if i do this no ads appear on top, i think the ad dont get the porper height here is my xml Message was edited by: pitup3
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.