I tested the ad function on my phone. Only test ad is shown. When I replace the device ID that I received from AdMob, real ads are not displayed.
What is the problem?
Here is my code:
<string name="banner_ad_unit_id">ca-app-pub-11*************1/7********5</string>
for used 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>
to load the ad that I used
AdView adView=(AdView)findViewById(R.id.adView);
AdRequest adRequest= new AdRequest.Builder().setRequestAgent("android_studio:ad_template").build();
adView.loadAd(adRequest);
In manifeast i
<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"/>
But my ads do not load on my Android device. Test ads work fine. I used a real device for all these operations. Any help please?
source
share