我已将 google dfp 添加到我的 Android 应用程序以使用插页式广告。
我用过GoogleAdMobAdsSdk-6.3.1.jar
.
我的 AndroidManifest.xml
<uses-sdk android:maxSdkVersion="17" android:minSdkVersion="14" android:targetSdkVersion="17" /> <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="@string/app_name" android:theme="@style/AppTheme" > <activity android:name=".SplashActivity" android:screenOrientation="portrait" android:theme="@android:style/Theme.Black.NoTitleBar" > <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> </activity> <!-- Ads Activity --> <activity android:name="com.google.ads.AdActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:screenOrientation="portrait" > </activity> ........
我的 SplashActivity
public class SplashActivity extends Activity implements AdListener{
/** Interstitial ad*/
private DfpInterstitialAd interstitialAd;
@Override
public void onCreate(Bundle icicle) {
super.onCreate(icicle);
setContentView(R.layout.activity_splash);
interstitialAd = new DfpInterstitialAd(SplashActivity.this, MY_INTERSTITIAL_UNIT_ID);
AdRequest adRequest = new AdRequest();
interstitialAd.loadAd(adRequest);
interstitialAd.setAdListener(SplashActivity.this);
但是当我改变设备的方向时,它的插页式也会改变她的方向。我想强制间隙方向只是纵向。