我在Google Play上有一款游戏,它正在显示广告(横幅广告),现在没有广告显示
可能的原因是什么?
在build.gradle中我有这个:
com.google.android.gms:play-services-ads:9.2.0
最新版本是9.4.0这可能是原因吗?但通过这种方式,如果这是一个原因,我应该为google-play-services的每次更新更新我的应用程序
另一件事:我将广告放入播放屏幕,以便播放器大部分时间看到广告这是一个问题,因为我在Admob政策中读到了一些关于意外点击的内容
AndroidManifest.xml
:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.mygdx.clockspuzzle"
android:versionCode="3"
android:versionName="1.0" >
<uses-sdk android:minSdkVersion="9" android:targetSdkVersion="23" />
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="Clocks Puzzles"
android:theme="@style/GdxTheme" >
<activity
android:name="com.mygdx.clockspuzzle.AndroidLauncher"
android:label="Clocks Puzzles"
android:screenOrientation="landscape"
android:configChanges="keyboard|keyboardHidden|orientation|screenSize">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
<activity
android:name="com.google.android.gms.ads.AdActivity"
android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" />
<meta-data android:name="com.google.android.gms.version"
android:value="@integer/google_play_services_version" />
</application>
</manifest>
AndroidLauncher
上课:
@Override
protected void onCreate (Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
RelativeLayout layout = new RelativeLayout(this);
requestWindowFeature(Window.FEATURE_NO_TITLE);
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FORCE_NOT_FULLSCREEN);
// gameView
AndroidApplicationConfiguration config = new AndroidApplicationConfiguration();
View gameView = initializeForView(new GameMain(this), config);
// adView
adView = new AdView(this);
adView.setAdSize(AdSize.SMART_BANNER);
adView.setAdUnitId(AD_UNIT_ID);
AdRequest.Builder builder = new AdRequest.Builder();
adView.loadAd(builder.build());
// add gameView
layout.addView(gameView);
// add adView
RelativeLayout.LayoutParams adParams =
new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT,
RelativeLayout.LayoutParams.WRAP_CONTENT);
adParams.addRule(RelativeLayout.ALIGN_PARENT_BOTTOM);
layout.addView(adView, adParams);
setContentView(layout);
}
我所说的是广告正确显示没有问题。