Reputation: 1
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 application, from a blank slate, with no changes.
Any clues?
This is what I have done so far:
Added Admob's library JAR.
Added these in my manifest (with a proper ID):
meta-data android:value="axxxxxxxxxxxxx" 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 layout (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();
Upvotes: 0
Views: 1664
Reputation:
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.
Upvotes: 1