Rewarded video No fill from ad server.Failed to load? Android

2.4k views Asked by At

I am trying to implement admob ads in fragment but its been a month and i am still getting error 3 ( No ads to fill ).

i have tried with new Id but still getting same error, test ads are working fine. logcat:

 
    08-03 16:59:21.653 9892-10265/? W/AdvertisingIdClient: Error while reading from SharedPreferences
    java.lang.SecurityException: MODE_WORLD_READABLE no longer supported
    at android.app.ContextImpl.checkMode(ContextImpl.java:2134)
    at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:354)
    at android.app.ContextImpl.getSharedPreferences(ContextImpl.java:349)
    at 
 com.google.android.gms.ads.identifier.AdvertisingIdClient.getAdvertisingIdInfo(Unknown Source)
    at com.duapps.ad.base.GoogleAdvertisingIdHelper.getAdIdNormal(GoogleAdvertisingIdHelper.java:46)
        at com.duapps.ad.base.GoogleAdvertisingIdHelper.getAdId(GoogleAdvertisingIdHelper.java:33)
        at com.duapps.ad.base.HttpParamsHelper.commonParams(HttpParamsHelper.java:118)
        at com.duapps.ad.stats.ToolStatsCore.pushToServer(ToolStatsCore.java:370)
        at com.duapps.ad.stats.ToolStatsCore.report(ToolStatsCore.java:325)
        at com.duapps.ad.stats.ToolStatsCore.handleMessage(ToolStatsCore.java:217)
        at android.os.Handler.dispatchMessage(Handler.java:98)
        at android.os.Looper.loop(Looper.java:154)
        at android.os.HandlerThread.run(HandlerThread.java:61)
        08-03 16:59:24.873 26224-26246/? D/DynamitePackage: Instantiating 
        com.google.android.gms.ads.adshield.ChimeraAdShieldCreatorImpl
        08-03 16:59:25.489 25315-25315/com.nsdeveloper.apppromotion I/Ads: 
        Starting ad request.
        08-03 16:59:25.489 25315-25315/com.nsdeveloper.apppromotion I/Ads: Use 
       AdRequest.Builder.addTestDevice("10C9D896CF812C194BD949D82F766C9B") 
        to get test ads on this device.
        08-03 16:59:25.850 25315-25332/com.nsdeveloper.apppromotion I/Ads: No fill from ad server.
        08-03 16:59:25.850 25315-25315/com.nsdeveloper.apppromotion W/Ads: Failed to load ad: 3
 

I am implementing ads in fragment so in context i was passing getActivity() :

MobileAds.initialize(getActivity(), "xxxxxxxxxxxxxxxxxxx");
mRewardedVideoAd = MobileAds.getRewardedVideoAdInstance(getActivity());
    mRewardedVideoAd.setRewardedVideoAdListener(rewardAdListener);
    loadRewardedAdVideo();

RewardVideoAdListener

RewardedVideoAdListener rewardAdListener = new RewardedVideoAdListener() {

    @Override
    public void onRewardedVideoAdLoaded() {
        Toast.makeText(getActivity(),"ad is loaded",Toast.LENGTH_SHORT).show();
        Log.d("ADS_SHOW","loaded");


    }

    @Override
    public void onRewardedVideoAdOpened() {

    }

    @Override
    public void onRewardedVideoStarted() {

    }

    @Override
    public void onRewardedVideoAdClosed() {
        loadRewardedAdVideo();
    }

    @Override
    public void onRewarded(RewardItem rewardItem) {
        int rewardPoints =   rewardItem.getAmount();
        int userPoints = getActivity().getSharedPreferences(PREFERENCE,0).getInt(POINTS,0) - rewardPoints;
        userRef.child(POINTS).setValue(userPoints);
        getActivity().getSharedPreferences(PREFERENCE,0).edit().putInt(POINTS,userPoints).commit();




    }

    @Override
    public void onRewardedVideoAdLeftApplication() {

    }

    @Override
    public void onRewardedVideoAdFailedToLoad(int i) {
        Toast.makeText(getActivity(),"No ads to show "+i,Toast.LENGTH_SHORT).show();
    }

    @Override
    public void onRewardedVideoCompleted() {





    }
};


private void loadRewardedAdVideo(){
    if(! mRewardedVideoAd.isLoaded()){
         mRewardedVideoAd.loadAd("ca-app-pub-xxxxxxxxx", new AdRequest.Builder().build());
    }
}

2

There are 2 answers

2
vaibhav sharma On

Try to run your ads on the test mode if it will show you the error then your code must be wrong read the doc of admob implementation Google docs for video ads

One thing i notied that you may be try to read the shared prefernece in the public mode it be written in the private mode thats why the error coming.

If u are seeing the ads in the test mode then there may me two things one your app id may be wrong second your area does not have the rewarded ads like this so google is not able to fill the ads

0
user3489401 On

I had the same problem - I read online that google can decide later if they turn your ads on or not.

Sometimes they turn ads off because the developer clicks on them. Many developers were doing so in the past and therefore google seems careful about it.

In the end I didn't resolve my issue with google - where I also wrote to their support and I registered with facebook network audience - it's the same, just facebook. Now I am getting them. There is also a system which allows you to register test devices - this means - by the ID of your phone, then you can also click on the adverts and there will be no problem with that - as it is now test device.

FB Rewarded Video