tags:

views:

484

answers:

2

I've included the relevant portion in my manifest:

<meta-data android:value="123456789" android:name="ADMOB_PUBLISHER_ID" />

            <!-- Track Market installs from AdMob ads -->             
            <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>
            <meta-data android:value="true" android:name="ADMOB_ALLOW_LOCATION_FOR_ADS" />'

and

<uses-sdk android:minSdkVersion="3" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>'

attrs copied right from the example:

<?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>

My layout (Which is a tabs view btw) is a table with it on its own row:

xmlns:app="http://schemas.android.com/apk/res/com.icukansas.lenscalculator"

and

<TableRow>
     <!-- Place an AdMob ad at the bottom of the screen. -->
    <!-- It has white text on a black background. -->
    <com.admob.android.ads.AdView
      android:layout_span="4"
      android:id="@+id/ad" 
      app:backgroundColor="#000000"
      app:primaryTextColor="#FFFFFF"
      app:secondaryTextColor="#CCCCCC"
      app:keywords="security"
    />
    </TableRow>

I then call:

public class myClass extends Activity implements AdListener{

public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState);

    setContentView(R.layout.tab_thistab);

    AdView ad = (AdView) findViewById(R.id.ad);
    ad.setAdListener(this);

Every time I get onFailedToReceiveAd error in the log.

I'm sure its something easy I'm missing :)

A: 

Yes You are missing two thing:

1.Most Important :

<meta-data android:value="a14e20856e4ad8f" android:name="ADMOB_PUBLISHER_ID" />

2.Refresh Interval:

android:id="@+id/ad" android:layout_width="fill_parent" android:layout_height="wrap_content" myapp:backgroundColor="#000000" myapp:primaryTextColor="#FFFFFF" myapp:secondaryTextColor="#CCCCCC" myapp:refreshInterval="30"
/>

Rest looks fine.

RockOn
I've got the first one in the AndroidManifest. I just made up the numbers but I have my real ID in my app.I've added refresh interval to my xml files and still no luck :(
Jason
I ended up putting the ad in my main.xml instead of the tab's xml and its working now.Never could quite figure out why it wouldn't request in my sub activity.
Jason
A: 

I had the same issue - friggin tabview. Placing it in the main activity instead of the tabs worked perfectly.

HoratioCain