The CommonsBlog

Sensors: Working, But How?

The Busy Coder’s Guide to Advanced Android Development has a chapter on sensors, featuring three demonstrations: a compass, a steering wheel, and a shake detector.

The compass and steering wheel demos relied upon the orientation sensor. The original, cryptically-documented way of working with the orientation sensor was deprecated. The documentation for the new way makes the old documentation seem like Dr. Seuss by comparison. It is entirely likely that there are lots of people who completely understand WTF “Computes the inclination matrix I as well as the rotation matrix R transforming a vector from the device coordinate system to the world’s coordinate system which is defined as a direct orthonormal basis” means.

To me, it means that I am dropping the Sensors chapter from the book, until such time as I grok what is going on.

However, the Sensors sample code still exists, and has been updated to use the new APIs. This is courtesy of a Google Group post that provided the recipe, which I then tweaked (e.g., converting radians to degrees). So, you are welcome to the code, but I just do not understand enough to be able to explain, convincingly, what this code is supposed to do.

While I could just keep the chapter with only the shaker demo, that is weak enough that I would rather pull the chapter entirely for the time being.

This change will occur in the next update, scheduled for next week. The good news is that the next update will cover so much new material, you will hardly miss the sensors chapter.

Need a speaker at your Android development meetup? Mark Murphy is available, in person in the Boston/Pittsburgh/DC triangle, or by remote anywhere in the world! Contact Mark for details!