Sophisticated smart phone applications such as maps or augmented reality use measurements of the Earth's magnetic and gravity fields to work out the orientation of the phone.
A typical smart phone has three magnetic field sensors, fixed perpendicular to each other, which are used to work out the local direction of Magnetic North.
In addition, they have three accelerometers which sense gravity to give tilt information and to help work out which way is down.
The application software uses the location of the phone from the mobile phone’s nearest base-station or from a GPS reading along with a map of the declination of the magnetic field (produced by BGS and NOAA in the USA) to work out the direction of True North at the user's location.
The declination angle is small in the UK (< 2°) but can be much larger in California (~15°) or in Brazil (> 20°). Users in these areas would quickly become lost if the application software didn’t correct for declination.