Take the 2-minute tour ×
Android Enthusiasts Stack Exchange is a question and answer site for enthusiasts and power users of the Android operating system. It's 100% free, no registration required.

Very often I use my phone lying in bed (with phone camera facing the ceiling) and the orientation changes drive me crazy. Literally if I turn the phone a few degrees it will go from portait to landscape and vice versa.

I can disable auto-rotation, but it's not desirable in some scenarios, like when i turn on my shoulder and I want the orientation to change.

Basically, is it possible to write your own logic for screen rotation and make it run on system wide scope?

UPD: I do not want to toggle auto-rotation. I want to rewrite that logic that based on current sensor setting changes the screen orientation on system level.

share|improve this question

migrated from stackoverflow.com Jun 25 '11 at 11:02

This question came from our site for professional and enthusiast programmers.

1  
You can, but you'll have to create a custom ROM. –  Haphazard Jun 24 '11 at 20:16
    
Hmm... Any leads on where to look? Anyway, thanks for the heads up, I completely forgot about custom roms –  Roman R. Jun 24 '11 at 20:18
    
Android is open-source so you you may be able to create one off of the Android code. If you're really lucky, you may be able to find the particular file that deals with the sensor, update it and then push it into your system without building a whole new ROM. Beyond that, I am of no help in this area. –  Haphazard Jun 24 '11 at 20:21
    
I've never used it so can't say for sure (thus a comment not an answer), but you might be able to do something to this effect using Tasker. –  eidylon Jul 29 '11 at 21:02

3 Answers 3

This widget works well... No customer rom or root required. :0)

share|improve this answer

You could write an app that locks to portrait orientation when whatever conditions you want are met.

So you could make it always be portrait unless the phone is held perfectly vertical in landscape position.

As far as I can tell, you can't force landscape orientation, so you'll have to just enable autorotation unless you want to make your own ROM.

Your app will probably need to be a Service and use SensorManager.

You can search the Android source on Google Code.

share|improve this answer

In CyanogenMod, and you can set up to have the power widget on the notification bar, the power widget in Cyanogen is enhanced so it can control more settings, one of it is the ability to lock the orientation sensor. Whenever you want to lock, simply pull out the notification bar and tap on the lock orientation button.

share|improve this answer
    
The author of the question explicitly said that he does not want to disable the rotation even temporarily; he wants to adjust its sensitivity. –  Dmitry Selitskiy Jun 26 '11 at 3:18

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.