.. Ok, that should have been Sensor.TYPE_ORIENTATION i.s.o. deprecated
SensorManager.SENSOR_ORIENTATION:
Sensor sensor_orientation = sensor_manager.getDefaultSensor
(Sensor.TYPE_ORIENTATION);
Now the event.values[] look like degrees but they never changes, e.g
event.values[0] is always just above 70 degrees no matter what
orientation the phone has.
On Aug 23, 10:25 am, olko <[email protected]> wrote:
> .. I run it on G1.
>
> On Aug 23, 10:14 am, olko <[email protected]> wrote:
>
>
>
> > I am experimenting with orientation sensor, register it like this:
>
> > SesnorManager sensor_manager = (SensorManager)getSystemService
> > (Context.SENSOR_SERVICE);
> > Sensor sensor_orientation = sensor_manager.getSensorList
> > (SensorManager.SENSOR_ORIENTATION).get(0);
> > sensor_manager.registerListener(sensor_listener, sensor_orientation,
> > SensorManager.SENSOR_DELAY_UI);
>
> > and then read the orientation values in the sensor event listener:
>
> > private final SensorEventListener sensor_listener = new
> > SensorEventListener() {
> > ...
> > float sensor_data_x = event.values[SensorManager.DATA_X];
> > ...
>
> > }
>
> > What comes out from this does not look like degrees, radians, or
> > anything that would reflect the phone orientation.
> > Am I missing something?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---