I’m trying to figure out how to modify this setting programmatically. Could someone indicate an API or suggest something?
The images illustrate where this option is in Android:


Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Check this link
http://developer.android.com/reference/android/provider/Settings.System.html#ACCELEROMETER_ROTATION
And here is the code for you
And this permission required in Manifest
<uses-permission android:name="android.permission.WRITE_SETTINGS" />