Android Question Orientation change on ads

tufanv

Expert
Licensed User
Longtime User
Hello

I have a weird problem. Some of the ads from admob changes the orientation of my app to landscape altough i only set to portrait mode in my app with #SupportedOrientations: portrait

And when this occurs, my app weirdly goes back to login screen ( for normal ads activity_resume triggers and the app continue on the panel where the user left while seeing the ad)

edit: further investigation showed me that when orientation changes , activity create is fired whereas when the portrait ad comes and orientation not changes only activity resume fires )

Is there any way i can avoid this ?
 
Last edited:

ilan

Expert
Licensed User
Longtime User

try to set this in manifest and see if it helps:

B4X:
SetActivityAttribute(Main, android:configChanges, "orientation|keyboardHidden|screenSize")

if not, you could use a global variable (boolean) like "adsentme" and when ad is shown set that variable to true, now on activity pause if "adsentme = true" save everything and on activity create if adsentme = true load everything like you leaved the app.


https://developer.android.com/guide/topics/resources/runtime-changes.html
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…