布局鼓励意外点击-机构间广告: [英] LAYOUT ENCOURAGES ACCIDENTAL CLICKS - INTERSTITIAL ADS:
问题描述
请提供任何帮助,由于插页代码错误,我的应用已被admob禁用
Please any one help Now my app has disable by admob due to wrong interstitial code as
"插页式广告在用户查看广告时意外加载 应用程序的内容".
"Interstitial ads that load unexpectedly while a user is viewing the app’s content".
该怎么办?请有人纠正我...
what to do? Please some one correct me...
import android.os.Bundle;
import android.view.Window;
import android.view.WindowManager;
import android.support.v7.app.AppCompatActivity;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
import com.google.android.gms.ads.AdListener;
import com.google.android.gms.ads.AdRequest;
import com.google.android.gms.ads.AdView;
import com.google.android.gms.ads.InterstitialAd;
public class a2 extends AppCompatActivity {
AdView mAdView;
InterstitialAd mInterstitialAd;
WebView WebViewWithCSS;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
setContentView(R.layout.activity_a2);
WebViewWithCSS = (WebView)findViewById(R.id.webView);
WebSettings webSetting = WebViewWithCSS.getSettings();
webSetting.setJavaScriptEnabled(true);
WebViewWithCSS.setWebViewClient(new WebViewClient());
WebViewWithCSS.loadUrl("file:///android_asset/2.html");
mAdView = (AdView) findViewById(R.id.adView);
AdRequest adRequest = new AdRequest.Builder()
.build();
mAdView.loadAd(adRequest);
mInterstitialAd = new InterstitialAd(this);
// set the ad unit ID
mInterstitialAd.setAdUnitId(getString(R.string.interstitial_full_screen));
adRequest = new AdRequest.Builder()
.build();
// Load ads into Interstitial Ads
mInterstitialAd.loadAd(adRequest);
mInterstitialAd.setAdListener(new AdListener() {
public void onAdLoaded() {
showInterstitial();
}
});
}
@Override
public void onPause() {
if (mAdView != null) {
mAdView.pause();
}
super.onPause();
}
@Override
public void onResume() {
super.onResume();
if (mAdView != null) {
mAdView.resume();
}
}
@Override
public void onDestroy() {
if (mAdView != null) {
mAdView.destroy();
}
super.onDestroy();
}
private void showInterstitial() {
if (mInterstitialAd.isLoaded()) {
mInterstitialAd.show();
}
}
}
推荐答案
来自admobs自己的指南
from admobs own guidelines
一个常见的问题是,即使您可能打算在页面内容之间加载广告,但由于运营商延迟,在加载新内容页面后不久,广告本身就会出现."
"A common issue is that even though you may intend for the ad to load in between page content, the ad itself appears shortly after a new page of content has loaded due to carrier latency."
您的代码在完成加载后会显示插页式广告-这不会向用户发出任何警告,因此他们将在查看Web视图的过程中突然出现插页式广告.预加载并自然休息一下.
Your code shows the interstitial when it has finished loading - this won't give the user any warning so they'll be in the middle of looking at the webview and suddenly the interstitial appears. Pre-load it and show it at a natural break.
您的代码在onAdLoaded()中调用showInterstitial()-它需要在需要广告之前调用mInterstitialAd.loadAd(),并设置一个标记以表示该广告存在.然后,它可以在加载网络视图之前调用showInterstitial(),并在关闭非页内广告时显示网络视图
Your code calls showInterstitial() in onAdLoaded() - it needs to call mInterstitialAd.loadAd() in advance of the ad being needed, and set a flag to say that it is present. It can then call the showInterstitial() before loading the webview and show the web view when the interstitial ad is dismissed
这篇关于布局鼓励意外点击-机构间广告:的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!