我已在我的Android应用中添加了谷歌dfp以使用插页式广告。
我使用了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);
但是当我改变设备的方向时,插页式广告也改变了她的方向。我想强迫插页式方向只是肖像。