4

I am using interstitial ads from Admob in my app. Google rejects my app and claims ad fraud. They say that my app displays an ad after exiting the app. I have changed my ad code to be sure that ad loading and ad displaying only happens when the activity is running and the app is in the foreground. Still they reject my app and claim ad fraud. I am just doing basic interstitial code here:

implementation 'com.google.android.gms:play-services-ads:19.7.0'

public class AdManager {
    boolean activityStarted;

    public void onStart() {
        activityStarted=true;
    }

    public void onStop() {
        activityStarted=false;
    }

    public void initializeAds(Context context) {
        MobileAds.initialize(context);
        MobileAds.setAppMuted(true);
        List<String> testDeviceIds = Arrays.asList("some id");
        RequestConfiguration configuration =
                new RequestConfiguration.Builder().setTestDeviceIds(testDeviceIds).build();
        MobileAds.setRequestConfiguration(configuration);
    }

    public InterstitialAd getInterstialAdWithUnit(Context context) {
        InterstitialAd mInterstitialAd = new InterstitialAd(context);
        mInterstitialAd.setAdUnitId(BuildConfig.INTERSTITIAL_AD_UNIT_ID);
        setAdListener(mInterstitialAd);
        checkNewAdNeeded(mInterstitialAd);
        return mInterstitialAd;
    }

    public void setAdListener(InterstitialAd mInterstitialAd) {
        mInterstitialAd.setAdListener(new AdListener() {
            @Override
            public void onAdClosed() {
                super.onAdClosed();
                checkNewAdNeeded(mInterstitialAd);
            }
        });
    }

    public void showAdIfNeeded(InterstitialAd mInterstitialAd) {
        if (activityStarted && mInterstitialAd.isLoaded())
            mInterstitialAd.show();
        else {
            checkNewAdNeeded(mInterstitialAd);
        }
    }


    public void requestNewInterstitial(InterstitialAd mInterstitialAd) {
        AdRequest adRequest = new AdRequest.Builder()
                .build();
                
        mInterstitialAd.loadAd(adRequest);
    }

    public void checkNewAdNeeded(InterstitialAd mInterstitialAd) {
        //do not load ad when acticity is stopped
        if (activityStarted && !mInterstitialAd.isLoading() && !mInterstitialAd.isLoaded())
            requestNewInterstitial(mInterstitialAd);
    }
}


public class FullscreenActivity extends AppCompatActivity {
    AdManager adManager=new AdManager();

    public void onButtonClicked() {
        //call another activity when Button is clicked and wait for return to display ad
        activity.startActivityForResult(intent, requestCode);
        runOnUiThread(new Runnable() {
            @Override
            public void run() {
                adManager.checkNewAdNeeded(mInterstitialAd);
            }
        });
    }

    @Override
    public void onActivityResult(int requestCode, int resultCode, Intent data) {
        super.onActivityResult(requestCode, resultCode, data);
        //back from other activity, try to display ads only if app has focus
        if ( from activity xy) {
            if (mHasFocus)
                showAdWhileHasFocus();
            else
                showAdWhenHasFocus=true;
        }
    }

    @Override
    protected void onStart() {
        super.onStart();
        adManager.onStart();
    }

    @Override
    protected void onStop() {
        adManager.onStop();
        super.onStop();
    }

    boolean showAdWhenHasFocus;


    public void showAdWhileHasFocus() {
        showAdWhenHasFocus=false;
        adManager.showAdIfNeeded(mInterstitialAd,promotionAndAdsEvent);
    }


   boolean mHasFocus=false;

    @Override
    public void onWindowFocusChanged(boolean hasFocus) {
        if (!hasFocus) {
        } else {
            if (showAdWhenHasFocus)
                showAdWhileHasFocus();
        }
        super.onWindowFocusChanged(hasFocus);
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
    }  
}

Alex
  • 343
  • 2
  • 13
  • 1
    I have the same problem. Do you have tried to not display the initial ad at the startup rather on a action. I think Google mean you can click by mistake on the ad when it pops up. – Tutorialwork Mar 05 '21 at 07:13
  • I am not displaying any ad at startup. I am displaying an ad after returning from another activity. I am not checking for the resultCode of onActivityResult so maybe if the other activity is open they run a test to close everything and exit the app and then the interstitial is shown before app exit. I uploaded a version with checking for resultCode and will see if it gets passed or not. – Alex Mar 05 '21 at 16:37
  • nope, still rejected – Alex Mar 07 '21 at 10:29
  • 2
    My update is now live. For me, it works to move the interstitial ad from the app start to another page. I think the problem can also if your interstitial ad surprise the user or interrupt the workflow. You can read the guidelines here: https://support.google.com/admob/answer/6201362?hl=en – Tutorialwork Mar 08 '21 at 16:11
  • 3
    My app is now life as well but only because my appeal has been approved. And my next app which shares the same code base has been rejected again. I played this game already for 4 apps. I have no interstitial ad at start. I think that they just have a false alarm on their analysis tools. – Alex Mar 09 '21 at 17:16

3 Answers3

0

I recently faced this issue. But got my app update approved after the following update:

We were having Interstitial ad right while opening the app, This was causing the next screen (Home dashboard) banner ad to hide behind the interstitial add. So I removed the interstitial. This got us the problem fixed.

It might be that playstore/Admob doesn't accept ad at app start, Might be they are trying to force us to use their app open ad instead of interstitial or any other ad unit.

JackSparrow
  • 948
  • 1
  • 11
  • 9
0

In my case it turned out to be an old version in the test track. In the first version I had an interstitial when exiting the app - which is not allowed. I fixed the issue, but still my app got rejected. After about 10 more tries, I realized that the first version of the app (with the interstitial on exit) was still in the test track, so I removed (or updated) the test track version, and my app was approved.

0

Seems like after 5 months of app rejections with ad fraud claims my apps are passing review process again. The final change I made was to change the Interstitial class in my AdMob lib to the new API.

import com.google.android.gms.ads.interstitial.InterstitialAd;
InterstitialAd mInterstitialAd;

MobileAds.initialize(...
mInterstitialAd.setFullScreenContentCallback(...
mInterstitialAd.show(...

Admob has made a lot of restructuring and I was using the legacy API. Though it was not declared as legacy until a few weeks ago. The first claim was for version 19.4.0 (https://developers.google.com/admob/android/rel-notes) and it continued until version 19.7.0. Here is a discussion about the topic. https://groups.google.com/g/google-admob-ads-sdk/c/XTJ9kcgxvbY

Alex
  • 343
  • 2
  • 13