0

I have integrated vungle video ads in my android application successfully but the ads are displaying in landscape mode only, but i want the ads to be displayed in the portrait mode .

I have done the following implementation in manifest file

 <activity
 android:name="com.vungle.publisher.FullScreenAdActivity"
 android:configChanges="keyboardHidden|orientation|screenSize"
 android:screenOrientation="portrait"
 android:theme="@android:style/Theme.NoTitleBar.Fullscreen"/>

And also for my activity :

<activity
            android:name=".CreateGame"
            android:screenOrientation="portrait"
            android:windowSoftInputMode="stateHidden|adjustPan" />

And I followed this url to setup the vungle ads https://github.com/Vungle/vungle-resources/blob/master/English/Android/current-release/android-dev-guide.md

And in my CreteGame Activity I followed the below code

in onCreate method I have done this thing :

  protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(R.layout.creategame);
            final String app_id = "App_id";

            // initialize the Publisher SDK
            vunglePub.init(this, app_id);
        }  

And I followed the below coding in my function()

final AdConfig globalAdConfig = vunglePub.getGlobalAdConfig();

             globalAdConfig.setOrientation(Orientation.autoRotate);
             globalAdConfig.setOrientation(Orientation.matchVideo);
            if(!vunglePub.isAdPlayable()) {
                return;
            }
            else{
                vunglePub.playAd(globalAdConfig);

            }

Please help me to display the ads in portrait view only thanks in advance

shobhan
  • 252
  • 3
  • 10

1 Answers1

0

You should remove:

globalAdConfig.setOrientation(Orientation.matchVideo);

and leave only:

globalAdConfig.setOrientation(Orientation.autoRotate);

It will display an ad in portrait if you hold a device in portrait. "matchVideo" should be mostly show it in landscape mode.

Thanks,

aki
  • 86
  • 1