Home » Java » Android Studio – Ad under webview doesn't load

Android Studio – Ad under webview doesn't load

Posted by: admin September 26, 2018 Leave a comment

Questions:

I have an app, with webview, and under it – ad. It doesn’t show any sign of the ad!

xml:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    tools:context=".MainActivity">

    <WebView
        android:id="@+id/webwiew"
        android:layout_width="match_parent"
        android:layout_height="wrap_content" />

    <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="adUnitId">
    </com.google.android.gms.ads.AdView>

</RelativeLayout>

(I inserted adUnitId)

Java:

MobileAds.initialize(this, "App Identify");
AdView mAdView = findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);

(I inserted App Identify)

Thank’s

Answers: