1. Check out our companion app, Forums for Android! Download from Google Play

Dev question - orientation sensors

Discussion in 'Android Devices' started by gezh, Nov 10, 2009.

  1. gezh

    gezh Well-Known Member
    Thread Starter

    Jul 12, 2009
    Hi all. For a bit of fun I've been developing a kind of spirit level app. It taps into the phone's sensors for horizontal and vertical orientation.

    When I had the HTC magic, which is flat, this worked fine. Now, with my Hero, the default levels are way off. For example, the sensor reading 0 should be flat, with a positive or negative figure meaning a tilt in either direction. With the Hero, what I consider to be level is a reading of about 5. The zero reading is noticeably tilted. I don't know if this is anything to do with the fact that the Hero has an angled front end, or not.

    Also, for vertical readings, the sensors don't seem to be accurate. As you tilt the phone towards vertical, the reading rises steadily, but as you get to around 75 degrees, it seems to get stuck, and then eventually will just straight to about 105. This makes it very hard to get an accurate vertical reading.

    Anyone have any ideas, or know anything, about this?



Share This Page