Skip to main content

motion sensor

2 replies [Last post]
warthds
Offline
Joined: 2008-10-14
Points: 0

HI,

hi, is it possible to to listen to an event with java2me if the resolution of an mobile phone changes through the motion sensor?

for example if i turn the phone about 90 degrees and the phone has an motion sensor.

thanks

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
jaywayjohan
Offline
Joined: 2008-06-18
Points: 0

Hi,

have you tried the Mobile Sensor API? The API gives access to the motion sensor(s). This might do the trick.

For more information about the API:
http://jcp.org/en/jsr/detail?id=256

On some phones it is possible to read a system property to find out if you are in landscape or portrait mode, but this is a less portable solution.

Regards
Johan

sfitzjava
Offline
Joined: 2003-06-15
Points: 0

Depends on the device, and the special APIs it has on it.
Native event calls that the OS might post from a motion sensor may not be visible from JavaME.
If the operator has special hooks into the motion sensor and provides access to it there may be the need to sign your midlet as well.

Now you might be able to do something yourself, by using the MMAPI to capture images from the camera and then do a comparison of the images to determine motion. If the phone auto orientates when capturing the image, you might be able to use the width & height of the captured image to determine a 90deg rotation has occurred.

-Shawn