Bug Issue: Can't prevent autorotate on Android

Pages: 1


  • Level 3 Stencyler
September 27, 2015, 02:32:13 pm
I have not ticked the autorotate in Stencyl game setting, but on Android the game rotates anyway; this is a problem because my game uses the Accelerometer and that make a mess with accelerometer orientation and characters coordinates.

I read this post on stackoverflow http://stackoverflow.com/questions/2730855/prevent-screen-rotation-android

In my Android Manifest is written:
and NOT  android:screenOrientation="portrait"

I tried to correct it by myself: I wrote "portrait" instead of "sensorPortrait" in the Manifest in my game generated folder, but when I export the game Stencyl overwrites the Manifest and it writes "sensorPortrait" again...

My game does open on portrait and does not rotate if I rotate +90 or -90 the problem is, if I rotate the device 180°, the game also rotates180°, while I would like the characters remain with feet up and head down.

I reported this problem here: http://community.stencyl.com/index.php/topic,43909.0.html
« Last Edit: September 27, 2015, 02:33:07 pm by Ogiul »

Issue updated by Ogiul - September 27, 2015, 02:33:07 pm
  • Issue renamed from "Cen't prevent autorotate on Android" to "Can't prevent autorotate on Android"

Issue updated by captaincomic - September 30, 2015, 05:48:11 pm
  • Tags added: android


  • Chief Stencyler
  • *
October 02, 2015, 11:08:46 am
As far as I can tell, OpenFL hard wires in the orientations to either sensorPortrait or sensorLandscape.

While you can edit the manifest template to stop this, we'd have to modify the system to hook this up to our UI.

1) Edit in text editor:
stencyl ▸ plaf ▸ haxe ▸ lib ▸ lime ▸ lime ▸ legacy ▸ templates ▸ android ▸ template ▸ AndroidManifest.xml

2) Look for sensorPortrait/sensorLandscape and switch to just portrait/landscape.
  • Status changed from New to Confirmed
« Last Edit: October 02, 2015, 11:09:03 am by Jon »


  • Level 3 Stencyler
October 03, 2015, 02:21:16 pm
Thank you, Jon!

I modified the AndroidManifest.xml as described here above and it works as expected: now, if I rotate my device, the app does not rotate at all. Great!

I'm sorry, I did not understand everything in your message (because English is not my first language)... Can I expect to see this fix implemented in the next (private or public) Stencyl build?



  • Chief Stencyler
  • *
October 03, 2015, 04:39:05 pm
It will arrive in the future but not in the near future. Since we have to make this option more configurable than it currently is, it isn't as easy as editing a file and will take some digging to make it work.

(Of course, if nobody wants auto-rotate, we could make the switch instantly.)


  • Level 3 Stencyler
October 05, 2015, 02:13:49 pm
I do not know if nobody wants the auto-rotate... But I think the most of the users does not expect that the app can rotate when the autorotate box is not ticked.

As for now, on Android, if you tick the autorotate box, the app rotates if you rotate the device 0, 90, 180 or 270...
If you does not tick it, the app rotates anyway... but only if you move the phone + or - 180.
So you have no way to prevent problems when using accelerometer.

On iOS it works as expected: when the box is not ticked the app can not rotate at all, when it is ticked it can rotate.


  • Level 3 Stencyler
October 07, 2020, 03:39:51 am
Hi @Jon!
I'm updating my game,  and now there is same problem on iOS too: my game rotates even if the check box "Auto-Rotate" in Settings window is not ticked,  so that all of the accelerometer interactions are very messy. I'm on Stencyl 4.0.2 (b10468).
Please can you tell me how to prevent autorotate on iOS and Android in 2020?



  • Master Stencyler
  • *
October 16, 2020, 09:03:21 am
This is fixed in private build 10630, and will be available in public release 4.1.0.

Ogiul, since you're not currently a subscriber, you'll need to make the changes yourself in order to test this, but it's pretty simple.

Open this file: [stencyl install]/plaf/haxe/lib/stencyl/1,00/templates/haxe/ApplicationMain.hx

Then, make this change to that file. Just copy the lines that have the green background, and paste them above the line that says "app = new Application ();". Then test your game again.
  • Issue Assigned from (none) to Justin
  • Status changed from Confirmed to Resolved
  • Tags added: 4.1.0, ios

Pages: 1


  • Reported
    September 27, 2015, 02:32:13 pm
  • Updated
    October 16, 2020, 09:03:21 am

  • View Status
  • Type
  • Status
  • Priority
  • Version
    Stencyl 3.3, 3.3.2
  • Fixed in
  • Assigned to
  • Category
    Game Settings