• Post Reply Bookmark Topic Watch Topic
  • New Topic

Handset orientation detection

 
Mahmudur Rahman
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way I can detect the orientation of the handset with respect to the user i.e. if the handset is held horizontal / vertical?
 
Tim Holloway
Bartender
Posts: 18470
61
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That depends on the device. The Apple iPhone has a builtin accelerometer that handles that function, but it's not available to application programmers - at least yet.

My HTC phone doesn't have motion-detection hardware, but if you slide out the QWERTY keyboard, an event is fired that cause the screen image to rotate. I don't know how to intercept it (it's probably a Win/CE event anyway), but I suspect I could tap into it if I needed to.

Most phones aren't smart enough to know anything at all about how the user is holding them. Newer phones are somewhat more likely to have sensor abilities, however as the cost of hardware continues to drop.
 
Syam Sathyan George
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
not yet in j2me!!!, Believe me, i am waiting for this to come out, might become a JSR soon.
 
Gravity is a harsh mistress. But this tiny ad is pretty easy to deal with:
the new thread boost feature: great for the advertiser and smooth for the coderanch user
https://coderanch.com/t/674455/Thread-Boost-feature
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!