views:

220

answers:

1

I have noticed that by shaking or tapping the phone (an SE Xperia x10 mini) several times recalibrates the magnetometer. Is there any way of doing this software-wise in a more controlled way?

A: 

I don't think so. It seems some sort of "hardware reset": when the magnetometer has been confused by a magnetic field (a loudspeaker is usually enough) it requires physical movement in order to return to a "plain state".

Lorenzo
Yes, that would be my guess as well. And I tested on a HTC Hero as well with similar result. Perhaps there is an event created that can be caught?
Majakk
That's a good question. Maybe you can check for accuracy changing to/from SENSOR_STATUS_UNRELIABLE, but I think it is device-dependent.
Lorenzo
Did not think of that! This will require some elaborate testing but might actually solve the problem in a quite elegant manner.
Majakk
Just for the record - the accuracy does not appear to be affected unfortunately. And as there isn't anything showing on the debug output when this happens. The last remote possibility now seems to be to make a prediction from the data itself - perhaps together with the accelerometer when this event are to happen.
Majakk
That's bad! On which device are you developing?
Lorenzo
Primarily I use an Sony Ericsson Xperia X10 mini running Android 1.6
Majakk