0

I am working for AdMob in Android and I got success in getting test ad. But When I Change My Test UnitId To Live UnitID something like this "ca-app-pub-xxxxxxxxxx/xxxxxxxxx" I am not getting any warning/ error. and also I commented the lines for adding test devices. but still i am not seeing any real adds.

Any Ideas..... Any Better Solution..

main.xml

        <com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
            android:id="@+id/adView"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_alignParentBottom="true"
            android:layout_centerHorizontal="true"
            ads:adSize="BANNER"
            ads:adUnitId="ca-app-pub-xxxxxxxxx/xxxxxxxxxx">
            <!-- I have replaced with my purchased id -->
        </com.google.android.gms.ads.AdView>

MainActivity.java

  private AdView mAdView;
    InterstitialAd mInterstitialAd;

    MobileAds.initialize(getActivity(), "ca-app-pub-xxxxxxxxxx/xxxxxxxxxx");
    //banner ad
    mAdView = fragView.findViewById(R.id.adView);
    AdRequest adRequest = new AdRequest.Builder().build();
    mAdView.loadAd(adRequest);
    AdRequest request = new AdRequest.Builder()
            .addTestDevice(AdRequest.DEVICE_ID_EMULATOR)
            .build();
     //InterstitialAd
       mInterstitialAd = new InterstitialAd(getApplicationContext());
      //replaced with my buy ads
    mInterstitialAd.setAdUnitId("ca-app-pub-xxxxxxxxxxxxxx/xxxxxxxxxx");
    mInterstitialAd.loadAd(new AdRequest.Builder().build());
    mInterstitialAd.setAdListener(new AdListener() {
        @Override
        public void onAdClosed() {
            super.onAdClosed();

        }


    });

NOTE : I have completed all the payments and necessary details while buying the ads from AdMobs & also the application is in releasing mode.

Mahak Singhvi
  • 69
  • 1
  • 8

0 Answers0