Magnetometer and compass heading
Reads magnetic field and heading; iOS true heading uses location services.
In one line
Can use your phone's compass and magnetic field, with a location link for true north
Reads magnetic field and heading; iOS true heading uses location services.
Reveals orientation and nearby magnetic objects (cars, metal), and is used for indoor positioning.
What it can and can't do
What the user does: Nothing, or you allow location when a compass wants true north on iPhone
It can
- Measure the magnetic field in microtesla
- Show compass heading toward magnetic north
- Give true north on iPhone after location is allowed
- Help find nearby metal or detect a magnet case
It cannot
- Show true north on iPhone without location access
- Give your location from the compass
- Ask you first on Android; no prompt is used
How it differs between platforms: Android needs no prompt for magnetic readings. iPhone raw heading works, but true north needs location services.
On Android and iPhone
| Android | iPhone | |
|---|---|---|
| Status | Supported | Partial |
| First version | Android 1.5 (API 3) | iOS 4.0 |
| Permission or entitlement | Not listed | prompt |
| Protection level | none | prompt |
| How access is granted | none | none |
| What the user sees | Not listed | Not listed |
| How long it lasts | Not listed | Not listed |
| How to take it back | Not listed | Not listed |
| Store policy | None listed | None listed |
| API | Sensor.TYPE_MAGNETIC_FIELD, TYPE_ROTATION_VECTOR | Magnetic heading raw; true north needs location |
| Notes | Field strength 25 to 65 microtesla typical | None |
Data you get
What comes back: Field vector, heading
Shape: stream
How often: Up to 50 Hz
| Field | Type | Unit | Range | Precision |
|---|---|---|---|---|
field | float | microtesla | -2000 to 2000 | about 0.1 |
Technical limits
- Needs calibration
The story
What it is
An app reads the magnetic field, which powers the compass and can show nearby metal.
For you
You see it as a compass needle in a map or a sky app that points to the right star. Most of the time you never notice the app reading it. It can also help place you inside a building.
For makers
Makers use it to turn maps to face your way, power AR and help find your spot indoors. It is a small fingerprint bit too, since each phone's compass has its own error.
Where you see it
| Type | Example | Apps |
|---|---|---|
| maps | A map app rotates the map to point the way you face while you walk. | Google Maps, Apple Maps |
| ar-vr | A star gazing app overlays constellations on the sky and follows your phone as you move it. | Star Walk, SkyView |
| games | An AR treasure hunt points an arrow toward a hidden item. | Ingress |
| travel | A pilgrim or hiking app shows true north and a direction to a landmark. | Qibla Finder |
| utilities | A metal detector app shows spikes when the magnetic field changes near a pipe. | None named |
| analytics | A tracker uses small magnetic quirks to tell phones apart, or maps indoor fields to find where you are. | None named |
Risks
- Indoor position clues
- Weak fingerprint bit
Android and iPhone in short
- Android: Android apps read the magnetic field with no prompt.
- iPhone: iPhone heading is available with no prompt, but true north needs location services.
What the platform says
- Google: Position sensors. Android lets apps use the magnetic field sensor for a compass and orientation.
Good uses and abuse
Legitimate uses
- Compass
Known abuse
- Fingerprint
Scores
| Score | Value | Meaning |
|---|---|---|
| Sensitivity | 2 of 5 | How revealing the data is |
| Utility | 2 of 5 | How useful it is to honest apps |
| Friction | 1 of 5 | How much the user has to do |
| Fingerprint bits | 3 | Rough identifying entropy, when known |
Related capabilities
Related
- Raw accelerometer and gyroscope. Can see how your phone moves and tilts, with no prompt
Same idea on the web
- Magnetometer. Can sense the magnetic field around your device, like a compass
Sources
How well checked: Based on official documentation.