Posts tagged with xml

I'm trying to put advertisements on my app, I put my app on amazon app store and then approved by google admob I set up Ad Unit ID (next level promotion) and put in both the xml and java part the appropriate code for it to work however I still don't get any Ad bar on the home of my app. Does anyone have any idea why it doesn't come up?

Java:

   ` MobileAds.initialize(this, initializationStatus -> {});     // Create an AdView and set the ad unit ID and ad size     adView = new AdView(this);     adView.setAdUnitId("*******");      adView.setAdSize(AdSize.BANNER);     // Add the AdView to your layout     LinearLayout adContainer = findViewById(R.id.ad_container);     if (adContainer != null) {         adContainer.addView(adView);         // Load an ad         AdRequest adRequest = new AdRequest.Builder().build();         adView.loadAd(adRequest);     }` 

XML:

       `<com.google.android.gms.ads.AdView         android:id="@+id/ad_container"         android:layout_width="match_parent"         android:layout_height="wrap_content"         android:layout_alignParentBottom="true"         app:adSize="BANNER"         app:adUnitId="***" />`