tags:

views:

52

answers:

1

Good evening.

I am currently developing an application and decided to try Admob ads. Unfortunately after following Admob's guide (pretty simple one, good job on that) I get no ad, whether I run it on the emulator or on my phone (HTC Desire). The weird part is that the ad has shown a couple of times (i really mean just a couple of times), in hundreds of tries. And checking my account on Admob I see that there are 6000 requests from this app. I started a new applcation, from blank, with no changes.

Any clues?

This is what I have done so far:

Added Adbmo's library jar.

Added these in my manifest (with a proper ID):

meta-data android:value="axxxxxxxxxxxxxx" android:name="ADMOB_PUBLISHER_ID" /
uses-permission android:name="android.permission.INTERNET" /

Created a attrs.xml file in res/values with this content:

?xml version="1.0" encoding="utf-8"?>
resources>
declare-styleable name="com.admob.android.ads.AdView">
attr name="backgroundColor" format="color" />
attr name="primaryTextColor" format="color" />
attr name="secondaryTextColor" format="color" />
attr name="keywords" format="string" />
attr name="refreshInterval" format="integer" />
/declare-styleable>
/resources>

Added the following to my layoyt (RelativeLayout):

below RelativeLayout line, with the correct application name instead of xxxx: xmlns:app="http://schemas.android.com/apk/res/com.me.xxxx"

and:
com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
app:backgroundColor="#000000"
app:primaryTextColor="#FFFFFF"
app:secondaryTextColor="#CCCCCC"
/>

As the above did not work I tried the following, but also without success:

AdView example_adview = (AdView) findViewById(R.id.ad); example_adview.setVisibility(AdView.VISIBLE); example_adview.requestFreshAd();

I would appreciate if someone could help me.

An off-topic question, when running my application (only this one) in ecplise (Windows), I always the device chooser, even though only my phone is connected and the emulator is not running. It's nothing that disturbs my development, but it's a bit annoying having to choose every time I run the application.

Thank you very much,
Kryex

A: 

Have you tried adding

AdManager.setTestDevices( new String[] {                 
        AdManager.TEST_EMULATOR 
});

to the Activity-class that is to show the ad?

If you're debugging using your phone you also need to add the ID of your phone to the array.

hpe
Thank you for your answer.Using test mode I got ads to show successfully, both on emulator and device.My question is whether the real ads will show up, when I take these test lines out, in my final application for other people? I get the feeling that they only show once every 100.The message I get in logcat is "No fill. Server replied that no ads are available". Is this normal?
Kryex