Android accelerometer orientation to ofSetOrientation()

Hi, coul someone point me in the right direction on how to set the orientation based on the data comming from the acceletometer ?

I guess you have to do the math yourself.


the application should do that automatically for you unless you tell it not to

so, nothing to edit in the androidmanifest.xml ?

thanks for your answer.


<activity android:name="MyActivity" android:label="@string/app_name" android:screenOrientation="sensorLandscape" android:configChanges="orientation">

Instead of “sensorLandscape”, you can select also “sensor” or “sensorPortrait”.