Wrox Programmer Forums

Need to download code?

View our list of code downloads.

| FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
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.
Reply With Quote
  #2 (permalink)  
Old May 3rd, 2009, 05:35 PM
Registered User
Join Date: May 2009
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts

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.
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

All times are GMT -4. The time now is 05:20 PM.

Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.