I'm trying to integrate admob for the first time. I followed the documentation rules here, and I've seen several related pages, but I still seem to be doing something wrong.
I'm using GoogleAdMobAdsSdk-6.1.0.jar, as well as android sdk version 13 (Android 3.2).
I included several things that I've found are required from various sources.
<uses-sdk
android:minSdkVersion="7"
android:targetSdkVersion="13" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
in my AndroidManifest.xml.
I included
target=android-13
in my project.properties.
The above configuration does not compile. I get an error in eclipse (Version: 4.2.0) stating the following:
error: Error: String types not allowed (at 'configChanges' with value 'keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize'
If I change it to the old style
android:configChanges="keyboard|keyboardHidden|orientation"
the project compiles just fine, but when I get to my activity I have the following problem:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@color/Aqua"
android:orientation="vertical" >
<LinearLayout
android:id="@+id/adLayout"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</LinearLayout>
</LinearLayout>
The code in my activity looks like this:
public class TutorialActivity extends Activity {
private static final String PUBLISHER_ID = "blah"; //omitted
private AdView adView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tutorial_layout);
AdRequest request = new AdRequest();
request.addTestDevice("what i believe is my device id");
adView = new AdView(this, AdSize.BANNER, PUBLISHER_ID);
LinearLayout layout = (LinearLayout) findViewById(R.id.adLayout);
layout.addView(adView);
adView.loadAd(request);
}
@Override
public void onDestroy() {
if (adView != null) {
adView.destroy();
}
super.onDestroy();
}
}
When I run this code and navigate to my activity, I see what looks to be an ad box at the top of the screen as I would expect, and inside it is the following text: You must have AdActivity declared in AndroidManifest.xml with configChanges.
I am one confused individual. This is the very last thing I'd like to include in my app before releasing it to the google app store, and any advice or help is much appreciated. I apologize if I've left anything out.