Reputation: 84
I've integrated Interstitial Ads in my app. Below are the transition,
- Screen 3
- Screen 4
- Screen 5
- Screen 6
Screen 2 - Screen 7
- Screen 8
- Screen 9
- Screen 10
- Screen 11
- Screen 12
While the transition happens from Screen 2 to Screen n (Where n is 3-12), an interstitial ad is called. I hope this is allowed to do.
Today, I have received a mail from Admob saying that Layout Encourages Accidental Clicks. How do I fix this? I'm not sure where I am going wrong.
Below is the code of one of the activities.
public class CC extends AppCompatActivity implements ConnectivityReceiver.ConnectivityReceiverListener {
ConnectivityReceiver conn;
CheckingStatus checkingStatus;
private static final String TAG = "CC";
private AdView mAdView;
InterstitialAd interstitial;
private static final String AD_UNIT_ID = "ca-app-pub-4189677300abcdefgh.....";
private InterstitialAd interstitialAd;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
checkingStatus=new CheckingStatus();
conn=new ConnectivityReceiver();
IntentFilter intentFilter=new IntentFilter();
intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION);
registerReceiver(conn, intentFilter);
checkfunction(CC.this);
setContentView(R.layout.cc);
getSupportActionBar().setTitle("CC");
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
//for banner ads
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder().build();
mAdView.loadAd(adRequest);
findViewById(R.id.cc1).setOnClickListener(listener_ca);
findViewById(R.id.cc2).setOnClickListener(listener_cb);
findViewById(R.id.cc3).setOnClickListener(listener_ccc);
//for interstitial ads
interstitialAd = new InterstitialAd(this);
interstitialAd.setAdUnitId(AD_UNIT_ID);
AdRequest aDRequest = new AdRequest.Builder().build();
interstitialAd.loadAd(aDRequest);
interstitialAd.setAdListener(new AdListener() {
@Override
public void onAdLoaded() {
if (interstitialAd.isLoaded()) {
interstitialAd.show();
}
}
@Override
public void onAdOpened() {
}
@Override
public void onAdFailedToLoad(int errorCode) {
}
});
};
View.OnClickListener listener_ca = new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CC.this, pt_ca.class);
startActivity(intent);
}
};
View.OnClickListener listener_cb = new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CC.this, pt_cb.class);
startActivity(intent);
}
};
View.OnClickListener listener_ccc = new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(CC.this, pt_ccc.class);
startActivity(intent);
}
};
public void checkfunction(Context context){
boolean isConnected=ConnectivityReceiver.isConnected();
checkingStatus.notification(isConnected,context);
}
@Override
protected void onResume() {
super.onResume();
MyApplication.getInstance().setConnectivityListener(this);
}
@Override
public void onNetworkConnectionChanged(boolean isConnected) {
checkfunction(this);
}
@Override
public boolean onSupportNavigateUp(){
finish();
return true;
}
}
What changes should I do to fix this issue?
Upvotes: 1
Views: 1202
Reputation: 475
You need to pre-load the ads and on click of the buttons and before the launch of new activity, you need to display them.
Upvotes: 1