session.heading reports the phone’s compass heading. Subscribe with onUpdate() to get a HeadingData every time the heading changes.
src/background/index.ts
Heading needs the LOCATION permission in your manifest, the same key session.location uses.

Continuous updates

onUpdate() delivers a HeadingData on each heading change. It returns an unsubscribe function.

HeadingData

Permission

session.heading.hasPermission is true when LOCATION is declared in your manifest. It reports the manifest declaration, not the OS grant: if the user denied the system location prompt, onUpdate() produces no reading. See Permissions.
session.heading works on both Android and iOS. It shares the LOCATION manifest key with session.location.