Skip to content

Instantly share code, notes, and snippets.

@kimukou
Created December 21, 2011 09:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kimukou/1505334 to your computer and use it in GitHub Desktop.
Save kimukou/1505334 to your computer and use it in GitHub Desktop.
AdMob_4.3.1Setting
AdView adView = (AdView)this.findViewById(R.id.adView);
adView.setAdListener(new AdListener() {}); //表示がでないときのリスナー登録
//参考:http://blogs.yahoo.co.jp/sao_kun2000/27732792.html
AdRequest adRequest = new AdRequest();
//adRequest.setTesting(true); //テスト表示モード
adView.loadAd(adRequest);
<activity android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"/>
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-sdk android:minSdkVersion="4" /> //動かすAndroidバージョン
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
android:id="@+id/AdMob"
android:layout_width="320dip"
android:layout_height="70dp"
android:gravity="center_horizontal">
<com.google.ads.AdView android:id="@+id/adView"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
ads:adUnitId="xxxxxxxxxxxx"
ads:adSize="BANNER"
ads:loadAdOnCreate="true" />
</LinearLayout>
Download)
http://code.google.com/intl/ja/mobile/ads/download.html
Doc)
http://code.google.com/intl/ja/mobile/ads/docs/android/banner_xml.html
Binary)
GoogleAdMobAdsSdk-4.3.1.jar
参考)
http://d.hatena.ne.jp/unagi_brandnew/20110515/1305413282
http://androyer.blogspot.com/2011/12/admob-version-431.html
備考)
プロジェクトとしてはAndroid 4.0
動かせるバージョンは 1.6以上
という指定は結構気持ち悪い〜
target=android-14 //13以上からAndroidManifest.xmlで定義されるフラグが使われる
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment