我測試應用程序時添加的應該是有一個框,表示將該活動添加到我的清單中,只要我添加了現在,那個盒子是。這裏是所有代碼放入我的應用程序我意識到現在有些是沒用的,因爲所有不同的事情我試過我的應用程序在不需要的代碼深處膝蓋深,如果你看到我可以刪除讓我知道的一切。AdMob廣告未向我的清單添加權限後未顯示
主要問題爲什麼廣告沒有出現
JAVA
AdView myAdView;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.game_play);
myAdView=(AdView)findViewById(R.id.adView);
AdRequest adRequest = new AdRequest();
adRequest.addTestDevice(AdRequest.TEST_EMULATOR);
myAdView.loadAd(adRequest);
主要佈局
xmlns:ads="http://schemas.android.com/apk/lib/com.google.ads"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/android_drinking"
tools:context=".PlayerInput" >
<com.google.ads.AdView
android:id="@+id/adView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
ads:adUnitId="a14ff402be4457c"
ads:adSize="BANNER"
ads:testDevices="TEST_EMULATOR"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:loadAdOnCreate="true"/>
ATTRS XML
<?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>
Android清單
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<meta-data android:value="YOUR_ID_HERE" android:name="ADMOB_PUBLISHER_ID" />
<!-- AdMobActivity definition -->
<activity android:name="com.admob.android.ads.AdMobActivity"
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
android:configChanges="orientation|keyboard|keyboardHidden" />
<!-- 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>
<activity
android:name="com.google.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
</application>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
</manifest>
鏈接到我今晚想要的tutorial。