Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2
This is the forum to discuss the Wrox book Professional Android Application Development by Reto Meier; ISBN: 9780470344712
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional Android Application Development ISBN: 978-0-470-34471-2 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old May 3rd, 2009, 05:09 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default Sensor changes in 1.5?

Looking through the official SDK documentation, I started to get quite confused about changes. (Side note: is there some way to see when looking at the reference documentation which change goes with which version of the SDK? So far it looks like ... no? Yipes!)

A number of the sensor techniques used in Chapter 10 then will become deprecated, as near as I can tell. Specifically:

SensorListener: deprecated, replaced by SensorEventListener and (for orientation, at least) OrientationEventListener helper class

SENSOR_ORIENTATION is now all under the Sensor class?

I'm just trying to gradually port some sensor code to the 1.5 SDK. Think it may be time to root my phone rather than wait for Google, since testing sensors in an emulator isn't the same.

Any particular advice in making this change? Chapter 10 I think is one of the best chapters of this book, so of course it'd be great to update it with new code.
 
Old May 3rd, 2009, 05:35 PM
Registered User
 
Join Date: May 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
Default

One other note re: sensors - I'm seeing values that appears to be swapped.

In chapter 10 (and, indeed, in Google's documentation), roll, pitch, and heading are:
roll = DATA_X
pitch = DATA_Y
heading = DATA_Z

Note that, if I'm reading the reference correctly, these may need to be swapped to values[3], [4], and [5] if you want them to persist between different orientations of the device. Irrespective of referring to them by int or name, though, in testing the app on the G1 / OS 1.1, I get:

heading = values[3] aka DATA_X
pitch = values[4] aka DATA_Y
roll = values[5] aka DATA_Z

Any idea what might account for this? Will this work across devices, or just the G1?

Maybe this is solved, though, by the new sensor API.








Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.