Hello everyone, I've received an alert by AdMob because of a violation of the AdMob program policies.
Basically, this:
"LAYOUT ENCOURAGES ACCIDENTAL CLICKS - INTERSTITIAL ADS:
Publishers are not permitted to encourage users to click AdMob interstitial ads in any way. Please review how you’ve implemented interstitial ads and be mindful of the following non-compliant implementation(s):
Interstitial ads that load unexpectedly while a user is viewing the app’s content."
Regarding the load of the interstitial Ads: it is done on the oncreate method in my activity class; then, the interstitial.show() is called in the intent for the launch activity.
Here there's my code:
My Activity class:
public InterstitialAd interstitialAds;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_erbario);
interstitialAds = new InterstitialAd(getBaseContext());
interstitialAds.setAdUnitId("myUnitId");
requestNewInterstitial();
button.setOnClickListener(new OnClickListener()
{
@Override
public void onClick(View v)
{
Intent intent = new Intent(ActivityHome.this, ActivityDettaglioPianta.class);
intent.putExtra("PIANTA", pianta);
startActivity(intent);
loadBanner();
}
});
}
private void requestNewInterstitial()
{
if (!interstitialAds.isLoading() && !interstitialAds.isLoaded()) {
AdRequest adrequest = new AdRequest.Builder()
.build();
interstitialAds.loadAd(adrequest);
}
}
private void loadBanner()
{
if(interstitialAds.isLoaded())
{
interstitialAds.show();
}
}
What is wrong with it, and what do I have to change/correct?