• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Displaying Admob Ads on Android

leefisher

Lurker
I'm having problems displaying ads in an Android application. I'm not seeing ads even in test mode.
The layout is taken from admob's instructions, as below:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res/lgf.fourinarow"
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">

<com.admob.android.ads.AdView
android:id="@+id/ad"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
app:backgroundColor="#000000"
app:primaryTextColor="#FFFFFF"
app:secondaryTextColor="#CCCCCC"
app:keywords="Android Game"
/>
</LinearLayout>
The mainfest is below:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="lgf.fourinarow"
android:versionCode="1"
android:versionName="1.0">
<!-- Requires Android 2.1 or above -->
<uses-sdk android:minSdkVersion="7" />
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name="LGFFourInARow">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<!-- Track Market installs -->
<receiver android:name="com.admob.android.ads.analytics.InstallReceiver" android:exported="true">
<intent-filter>
<action android:name="com.android.vending.INSTALL_REFERRER" />
</intent-filter>
</receiver>

<!-- The application's publisher ID assigned by AdMob -->
<meta-data android:value="xxxxxxxxxxxxxx" android:name="ADMOB_PUBLISHER_ID"/>
</application>
<!-- AdMob SDK permissions -->
<uses-permission android:name="android.permission.INTERNET" />
</manifest>
(I have my real publisher id in my code)
I my Java code, I have included AdManager.setTestDevices(new String[] { AdManager.TEST_EMULATOR } ); in the onCreate section, to enable tes mode. I've also added log messages in the onFailedToReceiveAd, onFailedToReceiveRefreshedAd, onReceiveAd and onReceiveRefreshedAd functions.
However I have still ever seen and ad, and can't see any output in the log cat.
Can anyone suggest what else I should be doing?
 
I'm not seeing it display at all, and I am getting logcat output which is indicating it is getting the ad's and what ad it returned. Just nothing is displayed. I even built the example in the SDK, and that doesn't work.
 
Back
Top Bottom