創建一個整數
private int showbigad =0;
在OnCreate中......
SharedPreferences prefs = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE);
String restoredText = prefs.getString("text", null);
if (restoredText != null) {
int advalue = prefs.getInt("showad", 0);
showbigad=advalue;
}
每個
現在點擊我們添加到showbigad
EACHONEOFYOURBUTTONS.onClick....{
showbigad =showbigad+1;
SharedPreferences.Editor editor = getSharedPreferences(MY_PREFS_NAME, MODE_PRIVATE).edit();
editor.putInt("showad", showbigad);
editor.commit();
}});
現在,如果按鈕已被點擊超過4次插播式廣告將顯示
if (mInterstitialAd.isLoaded()&& showbig>4) {
mInterstitialAd.show();
} else {
Intent intent = new Intent(this, magic.class);
startActivity(intent);
}
第二次加載插頁式廣告時是否收到任何消息? – VVB
@VVB Nope。加載插頁式廣告對我來說工作得很好。 – krikara