3

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?

Scalarr
  • 746
  • 7
  • 26

1 Answers1

0

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".

lornova
  • 6,667
  • 9
  • 47
  • 74
  • 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? – Scalarr Jun 14 '10 at 11:39
  • 1
    That's a good question. Maybe you can check for accuracy changing to/from SENSOR_STATUS_UNRELIABLE, but I think it is device-dependent. – lornova Jun 14 '10 at 12:06
  • Did not think of that! This will require some elaborate testing but might actually solve the problem in a quite elegant manner. – Scalarr Jun 14 '10 at 13:26
  • 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. – Scalarr Jun 15 '10 at 12:36
  • That's bad! On which device are you developing? – lornova Jun 15 '10 at 12:59
  • Primarily I use an Sony Ericsson Xperia X10 mini running Android 1.6 – Scalarr Jun 15 '10 at 14:22