views:

116

answers:

2

Okay, so I recently completed most of my first app for android. It's almost ready for the market, but I'd like to put in ads. I have installed and registered with AdWhirl, but I cannot figure out how to actually make ads show up, based on their instructions. I have found a few resources out there that help somewhat (such as http://malsandroid.blogspot.com/2010/05/admob-and-adwhirl.html ) but nothing that has actually let me make the ads work. I'm not sure if my inexperience is the issue or if the AdWhirl support is just that bad.

The AdWhirl support says: "4. In the Activity where you intend to add the ad: ● Import the com.adwhirl.AdWhirlLayout package ● Add an AdWhirl layout with a code snippet similar to below.

LinearLayout layout = (LinearLayout) findViewById(R.id.layout_main); AdWhirlLayout adWhirlLayout = new AdWhirlLayout(this, "AdWhirl SDK Key"); RelativeLayout.LayoutParams adWhirlLayoutParams = new RelativeLayout.LayoutParams( LayoutParams.FILL_PARENT, LayoutParams.WRAP_CONTENT); layout.addView(adWhirlLayout, adWhirlLayoutParams); layout.invalidate();"

I have added this code to my app, but I cannot get any ads to display. I DID import the package and I DID replace the "AdWhirl SDK Key" bit with my SDK Key so I know that is not the issue. I am wondering where this code snippet should be placed in my code and how I should modify this snippet to make ads work. Also, any insight as to what each piece of this code does (or is trying to do) would be extremely helpful.

Anyways, thanks for looking this over... I really appreciate.

A: 

There are several causes to your problem:

  1. Ads is likely loaded from the server, so if there is no connection to the internet from your phone/avd, then nothing you will see. Check the logcat, some exceptions will be there in that case.

  2. May be the code snippet is placed incorrectly. It should be placed into onCreate() method of your activity, which uses R.id.layout_main as the layout.

  3. Some problems on AdWhirl site. But this is not likely.

Anyway, you are not stricted to use AdWhirl, so you may try another ads provider like admob and smaato.

Vladimir Ivanov
A: 

Okay so the problem was with AdMob which I was using through AdWhirl. It took them a bit to begin sending me ads, although I'm not sure why.

I just started working on other parts of my code when I noticed that ads had appeared in the sections I had coded them into before.

So I guess the trick to this is to make sure you have all of your keys and IDs right on AdMob and AdWhirl, then sit back and wait for a bit until AdMob starts sending you stuff. Also, make sure your ads aren't inside a layout with padding as that will probably cause them to not show up.

alecazam