STMicroelectronics recently introduced its LSM303D accelerometer and magnetometer combo module to Chinese smartphone leader Xiaomi (Mi1S), known as the countrys answer to Apple.

ST developed its family of eCompasses around the principal of magneto resistance (MR) -- where a material changes the value of electrical resistance when an external magnetic field is applied -- to decrease power consumption. Devices, including the recently released LSM303, use MR matching or exceeding the performance of competitive devices in module size, full-scale resolution and noise, the release stated.

The LSM303 accurately measures the direction and magnitude of external magnetic fields, while the modules accelerometer compensates for tilt to ensure an accurate compass heading when portable devices are inclined. LSM303 combines a 3-axis magnetic-field sensor and a 3-axis accelerometer in a single tiny 2x2x1 mm module.
More on sensors here.