Android NDK screen orientation

I want to programmatically adjust the screen orientation using only Native. I know that I can set / lock the orientation in the AndroidManifest.xml file with android: screenOrientation = "landscape", but this means that I have to rebuild every time I want a different orientation for certain applications.

I would prefer to read the setting from a file, such as AndroidManifest, and set the orientation before EGL and OpenGL are initialized, so I don't need to rebuild the APK. If you need a different orientation, just edit the file and run the application.

I would also like to avoid any Java code if possible, since my application is written only in C ++.

I looked at the NDK source and found the AConfiguration_setOrientation function, but it does not work.

thanks

+4
source share

Source: https://habr.com/ru/post/1627580/


All Articles