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
2010-06-14 10:08:39
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
2010-06-14 11:39:31
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
2010-06-14 12:06:37
Did not think of that! This will require some elaborate testing but might actually solve the problem in a quite elegant manner.
Majakk
2010-06-14 13:26:31
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
2010-06-15 12:36:46
That's bad! On which device are you developing?
Lorenzo
2010-06-15 12:59:27
Primarily I use an Sony Ericsson Xperia X10 mini running Android 1.6
Majakk
2010-06-15 14:22:46