0

Did your account banner, ordered all of the keys, the layout, the startup code, etc. As a result, advertising is not showing any test advertising, nor my banner. The logs this error appears:

There was a problem getting an ad response. ErrorCode: 0
W / Ads: Failed to load ad: 0

What to do? I have searched through the entire Internet with this problem, but have not solved it. Banner was established on 10 hours ago. Tried on Android 4.2.2, 4.4.2, 6.0.1

MainActivity:

  MobileAds.initialize(getApplicationContext(), "my code");
        AdView mAdView = (AdView) findViewById(R.id.adView);
        AdRequest adRequest = new AdRequest.Builder().build();
        mAdView.loadAd(adRequest);

main.xml:

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

grandle:

dependencies {
    compile project(':ambilWarna')
    compile 'com.android.support:support-v4:21.0.3'
    compile 'com.android.support:appcompat-v7:23.4.0'
    compile 'com.android.support:design:23.4.0'
    compile 'com.google.firebase:firebase-ads:10.0.1'

}
apply plugin: 'com.google.gms.google-services'

manifest.xml:

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
    package="com.minin.floatbatpercentage"
    android:versionCode="2"
    android:versionName="1.1" >
<uses-permission android:name="android.permission.SYSTEM_ALERT_WINDOW" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
       <uses-permission android:name="android.permission.BOOT_COMPLETED"/>
    <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.BATTERY_STATS"/>
    <uses-sdk
        android:minSdkVersion="14"
        android:targetSdkVersion="22" />

    <application
        android:allowBackup="true"
        android:icon="@drawable/ic_launcher"
        android:label="@string/app_name"
        android:theme="@style/AppTheme" >
        <service android:name=".FloatingText"
            android:enabled="true"
            android:exported="true" >
        </service>
        <activity android:name=".Main">
            <intent-filter>
                <action android:name="android.intent.action.MAIN" />

                <category android:name="android.intent.category.LAUNCHER" />
            </intent-filter>
        </activity>
           <activity
            android:name=".About"
               android:configChanges="keyboardHidden|orientation|screenSize"
               android:label="@string/app_name"
            >

        </activity> 
         <receiver
            android:name=".BootReceiver"
            android:enabled="true"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.intent.action.BOOT_COMPLETED" />
            </intent-filter>
        </receiver>
        <receiver
            android:name=".BatteryReceiver"
            android:enabled="true"
            android:exported="false" >
            <intent-filter>
                <action android:name="android.intent.action.battery_changed" />
            </intent-filter>
        </receiver>

    </application>

</manifest>
RS90
  • 23
  • 7

2 Answers2

2

Just wait for a few hours and you'll start getting the ads. If it is a newly created ad unit id it will take some time for the servers to replicate it on all instances. There is No problem in your code

Shubham Shukla
  • 988
  • 2
  • 13
  • 28
  • Banner was established on 10 hours ago. – RS90 Jan 16 '17 at 18:18
  • Try adding this in your manifest – Shubham Shukla Jan 16 '17 at 18:26
  • Try adding addTestDevice in your Adrequest to see if it generating test ads – Shubham Shukla Jan 16 '17 at 18:33
  • No showing banner.... Test advertising: AdView mAdView = (AdView) findViewById(R.id.adView); AdRequest request = new AdRequest.Builder() .addTestDevice(AdRequest.DEVICE_ID_EMULATOR) .addTestDevice("CEBF7B7509A091849238F99072CCF6A7") .build(); mAdView.loadAd(request ); – RS90 Jan 16 '17 at 18:40
  • This is what google says "It could be that you have only recently created a new Ad Unit ID and requesting for live ads. It could take a few hours for ads to start getting served if that is that case. If you are receiving test ads then your implementation is fine. Just wait a few hours and see if you are able to receive live ads then. If not, can send us your Ad Unit ID for us to look into" but you can try changing your adunit id – Shubham Shukla Jan 16 '17 at 18:44
  • I just thought that test ads (generated) by Google must be displayed. I IS NOT visible as any test or manually by ad units ... – RS90 Jan 16 '17 at 18:53
  • Well it should but sometimes it not display ads.make sure you don't have any adblocker on your device and try with different adunit – Shubham Shukla Jan 16 '17 at 19:00
  • Test advertising is displayed in the emulator, but on a real device, it is not visible: Starting ad request. There was a problem getting an ad response. ErrorCode: 0 Failed to load ad: 0 Xiaomi Phone, No blocker is not necessary – RS90 Jan 16 '17 at 19:11
  • Added to the first post – RS90 Jan 16 '17 at 19:25
  • @RS90 add this in your manifest file and which version of google services are you using. – Shubham Shukla Jan 16 '17 at 19:32
  • Can you give an example of how to specify the version?@integer/google_play_services_version – RS90 Jan 16 '17 at 19:45
  • you don't need to add anything in integers.xml. When you link properly Google-play-services library to your project reference android:value="@integer/google_play_services_version" will be found and you are ready to go. When you add library to your project just do one more clean – Shubham Shukla Jan 16 '17 at 19:51
  • Added. Without changes – RS90 Jan 16 '17 at 19:59
  • good now wait or try with other adunits and one last thing make sure google play services is updated in your phone and running – Shubham Shukla Jan 16 '17 at 20:04
  • No. The emulator displays all (and test, and created banner ads), but in the real three-device advertising is not shown in the logs of different errors: ErrorCode: 0, ErrorCode: 2 – RS90 Jan 17 '17 at 12:16
  • then there is problem in your google play services try updating it. – Shubham Shukla Jan 17 '17 at 12:27
  • I do not know what to do, try different ad units, all working in the emulator, not on real devices. – RS90 Jan 17 '17 at 12:28
  • Google Services update on the device or in the Grandle? Smartphones all updated. – RS90 Jan 17 '17 at 12:29
  • on your device beacause problem is with your devices – Shubham Shukla Jan 17 '17 at 12:30
  • Verify that all services are updated on the three devices (Sony, Asus, Xiaomi) are stock firmware without blockers advertising ... What do I do? – RS90 Jan 17 '17 at 17:25
  • @there is problem with your ROM refer to this answer: http://stackoverflow.com/a/36876096/6291914 – Shubham Shukla Jan 17 '17 at 17:35
  • Hi @RS90 could you please accept the answer if it has helped you? – Shubham Shukla Jan 19 '17 at 16:25
0

I can't comment because I do not have enough rep, so I'll edit this as I walk through it. Do you have <uses-permission android:name="android.permission.INTERNET" /> in the manifest.xml?

EDIT:Thanks, other than that nothing is wrong with your code. As Shubham Shukla said above, since your ID is new, it will take time before it can fetch ads from the server.

Drew Szurko
  • 1,601
  • 1
  • 16
  • 32