我測試了手機上的廣告功能。只顯示測試廣告。當我使用我從AdMob獲得的單元ID替換單元ID時,不會顯示真實的廣告。AdMob實際廣告未顯示,僅顯示測試廣告
什麼問題?
這裏是我的代碼:
<string name="banner_ad_unit_id">ca-app-pub-11*************1/7********5</string>
對XML我使用
<com.google.android.gms.ads.AdView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
ads:adSize="BANNER"
android:id="@+id/adView"
ads:adUnitId="@string/banner_ad_unit_id">
</com.google.android.gms.ads.AdView>
加載廣告,我用
AdView adView=(AdView)findViewById(R.id.adView);
AdRequest adRequest= new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
adView.loadAd(adRequest);
在manifeast我
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>
。 。 。
<activity android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
android:theme="@android:style/Theme.Translucent"/>
但我的廣告不加載在Android設備上。測試廣告工作正常。 我用一個真正的設備進行所有這些操作。請幫忙嗎?
*對於我使用的廣告*,該代碼位於何處? –