Improvements to orientation locking on Android

grant

Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Nov 19, 2019
Messages
80
When locking the orientation to landscape or portrait we should let the player also use landscape flipped and portrait flipped. Sometimes it's nice depending on where the headphone jack is or side buttons.

We could change the suggested orientations from "portrait" and "landscape" to "userPortrait" and "userLandscape"

But since this requires API level 18 we should add backwards compatibility in Java. (Note: We still want to lock the orientation in the manifest too, because that gives it a better launch animation.)

Also I noticed there seems to be what may be a copy/paste error where onStart, onRestart, and onStop all call super.onResume(), so I changed that.

 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,497
From November on, ALL apps have to target API level 30
 

grant

Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Nov 19, 2019
Messages
80
Yes, they require a newer version be targeted every year when releasing on Google Play. Cerberus-X currently targets 28 and requires 16 by default, but I didn't do any changes on that.
 

Wingnut

Well-known member
3rd Party Module Dev
Tutorial Author
Joined
Jan 2, 2020
Messages
1,282
They update so damn quickly that you can't even get the time to read a book about one of the versions before another one is released!
 

MikeHart

Administrator
CX Code Contributor
3rd Party Module Dev
3rd Party Target Dev
3rd Party Tool Dev
Joined
Jun 19, 2017
Messages
3,497
Yup, if I had a say, I would drop that and the ios target :) To much effort.
 

SLotman

Active member
3rd Party Module Dev
Tutorial Author
Joined
Jul 3, 2017
Messages
239
On Android you can simply use sensorPortrait or sensorLandscape. The view is locked into portrait/landscape but if you rotate the phone the view will also rotate.

It is what I have used in all my games :)
 

grant

Member
CX Code Contributor
3rd Party Module Dev
3rd Party Tool Dev
Joined
Nov 19, 2019
Messages
80
According to the docs for Android "The sensor is used even if the user has locked sensor-based rotation."

I'm a perfectionist, so that is why I like using "user" instead.
 
Top Bottom