I have a game and it runs well on Android through an application called C4Droid (If you don't know about C4Droid, just google it). It is written in C++ and only uses SDL2.
It runs on portrait and so, when I tilt the device with auto-rotation turned on, it gets landscape.
Now, what I wanted is to do something that avoids it to get landscape even when auto-rotation is turned on. Answer please?
No, there is no way to do this in SDL2 only (you can in iOS, but for some reason they made it different in Android). wadali's answer is best, here are some ways you can use it in your build environment:
There are Android APIs for controlling the orientation, but you can't access them from within SDL2. SDL2 creates its own Activity and doesn't have any means of either extending it or letting you provide your own activity, so you cannot expose additional Android API calls to your own code.