我在我的应用中集成了非页内广告。以下是过渡,
- Screen 3
- Screen 4
- Screen 5
- Screen 6
Screen 2 - Screen 7
- Screen 8
- Screen 9
- Screen 10
- Screen 11
- Screen 12
当转换从屏幕2发生到屏幕n(其中n是3-12)时,会调用插页式广告。我希望这可以做到。
今天,我收到了Admob的一封邮件,称布局鼓励意外点击。我该如何解决?我不确定我哪里出错了。
以下是其中一项活动的代码。
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;
}
}
我应该采取哪些措施来解决此问题?
答案 0 :(得分:1)
您需要预加载广告,然后点击按钮,在启动新活动之前,您需要显示它们。