Search code examples
androidandroid-studioadmobbanner

Android studio banner ads not showing


Where do I make mistakes.Ads not appearing.Can you helpCan you helpCan you helpCan you help

manifest file '

package="com.cansifakitabi.ruyalarinanlami" >
<uses-permission android:name="android.permission.INTERNET"></uses-permission>
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />

<application
    android:allowBackup="true"
    android:icon="@drawable/favicon"
    android:label="Rüyaların Anlamı"
    android:screenOrientation="portrait"
    android:theme="@style/AppTheme" >

    <meta-data
        android:name="com.google.android.gms.version"
        android:value="@integer/google_play_services_version" />
    <activity
        android:name="com.cansifakitabi.ruyalarinanlami.MainActivity">



        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

    <activity
        android:name="com.cansifakitabi.ruyalarinanlami.Webactivity">

    </activity>

    <activity
        android:name="com.google.android.gms.ads.AdActivity"
        android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize"
        android:theme="@android:style/Theme.Translucent" />
</application>

'

java file

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

string.xml file

ca-app-pub-71396921xxxxxxx/xxxxxxxx

layout.xml

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:ads="http://schemas.android.com/apk/res-auto"
    android:orientation="vertical"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent">

<LinearLayout android:id="@+id/linearLayoutWebView"
        android:layout_height="match_parent"
        android:layout_width="match_parent"
        android:orientation="vertical">
        <WebView xmlns:android="http://schemas.android.com/apk/res/android"
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:fitsSystemWindows="true"
            android:id="@+id/web_engine"
            />
    </LinearLayout>

<LinearLayout android:layout_width="fill_parent"
    android:id="@+id/ad_layout" android:layout_height="wrap_content"
    android:gravity="bottom" android:layout_alignParentBottom="true"
    android:layout_alignBottom="@+id/linearLayoutWebView">
    <com.google.android.gms.ads.AdView
        android:id="@+id/adView"
        android:layout_width="fill_parent"
        android:layout_height="wrap_content"
        ads:adSize="BANNER"
        ads:adUnitId="@string/banner_ad_unit_id"/>
</LinearLayout>

enter image description here


Solution

  • Google doesnt not allow, developers to use real Banners while an app is in Developent use a test banner.

    There are 2 ways to implement this

    1. Use the Banner Id ca-app-pub-3940256099942544/6300978111

    2. Add a test device to your AdRequest

      AdRequest adRequest = new AdRequest.Builder()
          .addTestDevice("0FA20932AFE1095798444FD9AAB7D425")
          .build();