Skip to main content

motion sensor

2 replies [Last post]
Joined: 2008-10-14


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.


Reply viewing options

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


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:

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.


Joined: 2003-06-15

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.