2010-12-19 20 views
1

Androidアプリケーションに広告を表示する際に問題が発生しています。テストモードでも広告は表示されません。AndroidでAdmob広告を表示する

以下のようなレイアウトは、AdMobの指示から取られる:mainfestは以下の通りです

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

私のJavaコードで
<?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.Inst allReceiver" 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> 

(私は私のコードで私の本当の発行者IDを持っている) 私は、をonCreateセクションに含めて、テストモードを有効にしました。 onFailedToReceiveAdonFailedToReceiveRefreshedAdonReceiveAd、およびonReceiveRefreshedAdの機能にログメッセージを追加しました。 しかし、私はまだ見て広告をしているし、ログcatの出力を見ることができません。 誰も私がやっていなければならないことを提案することはできますか?

答えて

0

マニフェストの<application>タグの前にインターネット許可を入れてください。

<!-- AdMob SDK permissions --> 
    <uses-permission android:name="android.permission.INTERNET" /> 
    </application> 
</manifest> 

また、ブラウザでWebページを読み込むことができることを確認しましたか?エミュレータにDNSの問題があることがあります。

1

アクセシビリティACCESS_NETWORK_STATE が必要です。

関連する問題