-3

Admob banner ad shows in my device but does'nt shows in other devices. I gave a test device id. and adView is from my real app. that is very strange for me. When i run android studio attaching my samasung j2 then ads show. but when i generate signed apk and install another android device then does'nt show ads.

this is my xml file

<com.google.android.gms.ads.AdView
     android:id="@+id/adView"
     android:layout_width="wrap_content"
      android:layout_height="wrap_content"
       android:layout_alignParentBottom="true"
 ads:adSize="BANNER"
ads:adUnitId="@string/banner_home_footer">

this is my java file code

    AdRequest adRequest = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .addTestDevice("ca-app-pub3940256099942544/6300978111").build();
    mAdView.loadAd(adRequest);

android manifest xml file code is

 <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<!-- for ads-->
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
 <uses-permission android:name="android.permission.BLUETOOTH" />

       <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|
           orientation|screenLayout|uiMode|
            screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />
Hayk Abelyan
  • 326
  • 2
  • 3
  • 19
ttoseeff
  • 59
  • 2
  • 8

1 Answers1

0

Do something like :

AdView mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

remove these line from your code because you are using test add device so please remove these line of code and try again

AdRequest adRequest = new AdRequest.Builder()
.addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
.addTestDevice("ca-app-pub3940256099942544/6300978111").build();
Satyavrat
  • 469
  • 1
  • 7
  • 24