{"_id":"@capawesome/capacitor-compass","_rev":"4-a2e01daf59231110886184f49c78adaf","name":"@capawesome/capacitor-compass","dist-tags":{"latest":"0.1.2"},"versions":{"0.0.1":{"name":"@capawesome/capacitor-compass","version":"0.0.1","keywords":["capacitor","plugin","native"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-compass@0.0.1","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/plugins/compass/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"a98513158453aba46121a1dfe382a4c19e0460a6","tarball":"https://registry.npmjs.org/@capawesome/capacitor-compass/-/capacitor-compass-0.0.1.tgz","fileCount":40,"integrity":"sha512-eN1eLVN0sfRxuc/S7cIsRGl/8GE5KbRVQT0legADv99ABJdkXj4GtQnrUCEmXiKdVLjXCx6chPxOLmlvlnbAqA==","signatures":[{"sig":"MEUCIQCk20Fb+4FvsLhxZOy0bo1TQWMEovmta1gEuju2uKEzEwIgGBhAw23xgzkoSKg8K3FxvE7wgM2FPsigNVV481FB+YI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":57711},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","funding":[{"url":"https://github.com/sponsors/capawesome-team/","type":"github"},{"url":"https://opencollective.com/capawesome","type":"opencollective"}],"gitHead":"8dd31ce5d3f16f94fb71d033f47512e99908f4e4","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api CompassPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:ios && npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","swiftlint":"node-swiftlint","verify:ios":"cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd ..","ios:pod:install":"cd ios && pod install --repo-update && cd ..","ios:spm:install":"cd ios && swift package resolve && cd .."},"_npmUser":{"name":"robingenz","email":"mail@robingenz.dev"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"repository":{"url":"git+https://github.com/capawesome-team/capacitor-plugins.git","type":"git"},"_npmVersion":"11.13.0","description":"Capacitor plugin for reading the device compass heading.","directories":{},"_nodeVersion":"24.16.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.57.0","rimraf":"6.1.2","rollup":"4.53.3","swiftlint":"2.0.0","typescript":"5.9.3","@capacitor/cli":"8.0.0","@capacitor/ios":"8.0.0","@capacitor/core":"8.0.0","@capacitor/docgen":"0.3.1","@capacitor/android":"8.0.0","@ionic/eslint-config":"0.4.0","prettier-plugin-java":"2.6.7"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-compass_0.0.1_1783405242842_0.010533324041444247","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@capawesome/capacitor-compass","version":"0.1.0","keywords":["capacitor","plugin","native","capacitor-plugin","compass","heading","compass heading","magnetic north","true north","magnetometer","device orientation"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-compass@0.1.0","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/compass/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"f659a10a353369ed3deb2c981422cb1262c0463c","tarball":"https://registry.npmjs.org/@capawesome/capacitor-compass/-/capacitor-compass-0.1.0.tgz","fileCount":40,"integrity":"sha512-rfhDJAPXk1VXgAeSqiL4zJKa8G4ouPMEXUMH+A7aSdzQoSkpUAx2qKfVeNqX7UpzntHd2lQpGravNeoFOyozRg==","signatures":[{"sig":"MEUCIQCPANooyKMGlErjBgUFVl/j+oJ5nibUZ5aFzrGPilf6pgIgOJqKfvYJcjFvBoVzttkJy8KuDfctO/fnfqI/zlNaNNY=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-compass@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":62016},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","funding":[{"url":"https://github.com/sponsors/capawesome-team/","type":"github"},{"url":"https://opencollective.com/capawesome","type":"opencollective"}],"gitHead":"1ce17b1fd14c43b2f1d5d3c2da82221e1d1dca37","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api CompassPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:ios && npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","swiftlint":"node-swiftlint","verify:ios":"cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd ..","ios:pod:install":"cd ios && pod install --repo-update && cd ..","ios:spm:install":"cd ios && swift package resolve && cd .."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4e261d04-1fea-4589-a8ab-f316de2b7792"}},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"repository":{"url":"git+https://github.com/capawesome-team/capacitor-plugins.git","type":"git"},"_npmVersion":"11.16.0","description":"Capacitor plugin for reading the device compass heading on Android and iOS.","directories":{},"_nodeVersion":"24.18.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.57.0","rimraf":"6.1.2","rollup":"4.53.3","swiftlint":"2.0.0","typescript":"5.9.3","@capacitor/cli":"8.0.0","@capacitor/ios":"8.0.0","@capacitor/core":"8.0.0","@capacitor/docgen":"0.3.1","@capacitor/android":"8.0.0","@ionic/eslint-config":"0.4.0","prettier-plugin-java":"2.6.7"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-compass_0.1.0_1784015517654_0.6668225476859992","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@capawesome/capacitor-compass","version":"0.1.1","keywords":["capacitor","plugin","native","capacitor-plugin","compass","heading","compass heading","magnetic north","true north","magnetometer","device orientation"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-compass@0.1.1","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/compass/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"af70945dac1cb9081df0c9a633641c9f99c49537","tarball":"https://registry.npmjs.org/@capawesome/capacitor-compass/-/capacitor-compass-0.1.1.tgz","fileCount":40,"integrity":"sha512-XfsPBZDSU68wvpsmbjfkd+OT32MHiN5MzJiN82WjMDBZ26JiMfME4xv86MxH3aCveeVMYn3kE5KieiPZeUzz0Q==","signatures":[{"sig":"MEYCIQDgRNyz9TW2wicDIwUlbr802s6z8mn0S751uHrUOyAbJgIhAKhdi5b/nOKUwDTUXQOJa+EFBm5H2DJjwwze78daiOjB","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-compass@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":62025},"main":"dist/plugin.cjs.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","module":"dist/esm/index.js","funding":[{"url":"https://github.com/sponsors/capawesome-team/","type":"github"},{"url":"https://opencollective.com/capawesome","type":"opencollective"}],"gitHead":"3e61f4b412f9f3f512c21169bb135bbb23a67e6d","scripts":{"fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","docgen":"docgen --api CompassPlugin --output-readme README.md --output-json dist/docs.json","eslint":"eslint . --ext ts","verify":"npm run verify:ios && npm run verify:android && npm run verify:web","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","swiftlint":"node-swiftlint","verify:ios":"cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..","verify:web":"npm run build","prepublishOnly":"npm run build","verify:android":"cd android && ./gradlew clean build test && cd ..","ios:pod:install":"cd ios && pod install --repo-update && cd ..","ios:spm:install":"cd ios && swift package resolve && cd .."},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4e261d04-1fea-4589-a8ab-f316de2b7792"}},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"repository":{"url":"git+https://github.com/capawesome-team/capacitor-plugins.git","type":"git"},"_npmVersion":"11.16.0","description":"Capacitor plugin for reading the device compass heading on Android and iOS.","directories":{},"_nodeVersion":"24.18.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.57.0","rimraf":"6.1.2","rollup":"4.53.3","swiftlint":"2.0.0","typescript":"5.9.3","@capacitor/cli":"8.0.0","@capacitor/ios":"8.0.0","@capacitor/core":"8.0.0","@capacitor/docgen":"0.3.1","@capacitor/android":"8.0.0","@ionic/eslint-config":"0.4.0","prettier-plugin-java":"2.6.7"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"tmp":"tmp/capacitor-compass_0.1.1_1784102971879_0.39500849098946134","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"name":"@capawesome/capacitor-compass","version":"0.1.2","description":"Capacitor plugin for reading the device compass heading on Android and iOS.","main":"dist/plugin.cjs.js","module":"dist/esm/index.js","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","repository":{"type":"git","url":"git+https://github.com/capawesome-team/capacitor-plugins.git"},"bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"funding":[{"type":"github","url":"https://github.com/sponsors/capawesome-team/"},{"type":"opencollective","url":"https://opencollective.com/capawesome"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/compass/","keywords":["capacitor","plugin","native","capacitor-plugin","compass","heading","compass heading","magnetic north","true north","magnetometer","device orientation"],"scripts":{"verify":"npm run verify:ios && npm run verify:android && npm run verify:web","verify:ios":"cd ios && pod install && xcodebuild -workspace Plugin.xcworkspace -scheme Plugin -destination generic/platform=iOS && cd ..","verify:android":"cd android && ./gradlew clean build test && cd ..","verify:web":"npm run build","lint":"npm run eslint && npm run prettier -- --check && npm run swiftlint -- lint","fmt":"npm run eslint -- --fix && npm run prettier -- --write && npm run swiftlint -- --fix --format","eslint":"eslint . --ext ts","prettier":"prettier \"**/*.{css,html,ts,js,java}\"","swiftlint":"node-swiftlint","docgen":"docgen --api CompassPlugin --output-readme README.md --output-json dist/docs.json","build":"npm run clean && npm run docgen && tsc && rollup -c rollup.config.mjs","clean":"rimraf ./dist","watch":"tsc --watch","ios:pod:install":"cd ios && pod install --repo-update && cd ..","ios:spm:install":"cd ios && swift package resolve && cd ..","prepublishOnly":"npm run build"},"devDependencies":{"@capacitor/android":"8.0.0","@capacitor/cli":"8.4.2","@capacitor/core":"8.0.0","@capacitor/docgen":"0.3.1","@capacitor/ios":"8.0.0","@ionic/eslint-config":"0.4.0","eslint":"8.57.0","prettier-plugin-java":"2.9.7","rimraf":"6.1.2","rollup":"4.62.3","swiftlint":"2.0.0","typescript":"5.9.3"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"publishConfig":{"access":"public"},"gitHead":"7c1937ed10b7de86ca2c1cdc3539a2735fd69a00","_id":"@capawesome/capacitor-compass@0.1.2","_nodeVersion":"24.19.0","_npmVersion":"11.17.0","dist":{"integrity":"sha512-LIaXlbFhmVCRYA+nk2vDVAzdk3PHMhrQ+NuNH4IuKVGwquBrVtwM9TPpjV+47EzJIpWaWXmzE6glNioO5uXpcg==","shasum":"b955e4dfa521b4beec17b5404337bb3b0ed817d2","tarball":"https://registry.npmjs.org/@capawesome/capacitor-compass/-/capacitor-compass-0.1.2.tgz","fileCount":40,"unpackedSize":62334,"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-compass@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIHaxZnPsPXBu/8k+zygGxtZNqG2SLSZNB4Bsi4fG3WYJAiEApjdHB4+B/pYE+6jEh11tcxWcrTBjFBAcnKW0EJ0IL+M="}]},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:4e261d04-1fea-4589-a8ab-f316de2b7792"}},"directories":{},"maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/capacitor-compass_0.1.2_1788337329083_0.28304313635476563"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-07T06:20:42.723Z","modified":"2026-09-02T08:22:09.691Z","0.0.1":"2026-07-07T06:20:43.021Z","0.1.0":"2026-07-14T07:51:57.782Z","0.1.1":"2026-07-15T08:09:31.997Z","0.1.2":"2026-09-02T08:22:09.274Z"},"bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","homepage":"https://capawesome.io/docs/sdks/capacitor/compass/","keywords":["capacitor","plugin","native","capacitor-plugin","compass","heading","compass heading","magnetic north","true north","magnetometer","device orientation"],"repository":{"type":"git","url":"git+https://github.com/capawesome-team/capacitor-plugins.git"},"description":"Capacitor plugin for reading the device compass heading on Android and iOS.","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"readme":"# Capacitor Compass Plugin\n\nCapacitor plugin for reading the device compass heading.\n\n<div class=\"capawesome-z29o10a\">\n  <a href=\"https://cloud.capawesome.io/\" target=\"_blank\">\n    <img alt=\"Deliver Live Updates to your Capacitor app with Capawesome Cloud\" src=\"https://cloud.capawesome.io/assets/banners/cloud-build-and-deploy-capacitor-apps.png?t=1\" />\n  </a>\n</div>\n\n## Features\n\n- 🧭 **Heading**: Read the current compass heading on demand.\n- 🔄 **Live updates**: Listen for continuous heading changes.\n- 🌍 **True north**: Read the true (geographic) north heading on iOS.\n- 🤝 **Compatibility**: Works alongside the [Accelerometer](https://capawesome.io/docs/sdks/capacitor/accelerometer/), [Barometer](https://capawesome.io/docs/sdks/capacitor/barometer/) and [Gyroscope](https://capawesome.io/docs/sdks/capacitor/gyroscope/) plugins.\n- 📦 **CocoaPods & SPM**: Supports CocoaPods and Swift Package Manager for iOS.\n- 🔁 **Up-to-date**: Always supports the latest Capacitor version.\n\nMissing a feature? Just [open an issue](https://github.com/capawesome-team/capacitor-plugins/issues) and we'll take a look!\n\n## Use Cases\n\nThe Compass plugin is typically used whenever an app needs to know which direction the device is pointing, for example:\n\n- **Compass apps**: Build a classic compass UI that rotates with live heading updates.\n- **Navigation**: Rotate a map or show the direction the user is currently facing.\n- **Outdoor activities**: Guide hikers or geocachers towards a target bearing.\n- **Points of interest**: Point the user towards a fixed geographic direction, such as a landmark or a prayer direction.\n\n## Compatibility\n\n| Plugin Version | Capacitor Version | Status         |\n| -------------- | ----------------- | -------------- |\n| 0.x.x          | >=8.x.x           | Active support |\n\n## Guides\n\n- [The Complete Guide to Capacitor Device Sensors](https://capawesome.io/blog/capacitor-device-sensors-guide/): How heading data fits into navigation and wayfinding features.\n\n## Installation\n\nYou can use our **AI-Assisted Setup** to install the plugin.\nAdd the [Capawesome Skills](https://github.com/capawesome-team/skills) to your AI tool using the following command:\n\n```bash\nnpx skills add capawesome-team/skills --skill capacitor-plugins\n```\n\nThen use the following prompt:\n\n```\n Use the `capacitor-plugins` skill from `capawesome-team/skills` to install the `@capawesome/capacitor-compass` plugin in my project.\n```\n\nIf you prefer **Manual Setup**, install the plugin by running the following commands and follow the platform-specific instructions below:\n\n```bash\nnpm install @capawesome/capacitor-compass\nnpx cap sync\n```\n\nThis plugin is only available on **Android** and **iOS**. On the Web, all methods reject as unimplemented.\n\n### iOS\n\n#### Privacy Descriptions\n\nThe magnetic heading is available without any permission. To also read the true (geographic) north heading, location services must be enabled and the `NSLocationWhenInUseUsageDescription` key must be added to the `Info.plist` file of your app.\n\n```xml\n<key>NSLocationWhenInUseUsageDescription</key>\n<string>Your location is used to determine the true (geographic) north heading.</string>\n```\n\nIf the key is missing or location permission is not granted, the `trueHeading` value is `null`.\n\n## Configuration\n\nNo configuration required for this plugin.\n\n## Usage\n\nThe following examples show how to check if the compass sensor is available, read the current heading, and listen for heading changes.\n\n### Check if the compass sensor is available\n\nBefore reading the heading, you can check whether the device has a compass sensor. Only available on Android and iOS:\n\n```typescript\nimport { Compass } from '@capawesome/capacitor-compass';\n\nconst isAvailable = async () => {\n  const { available } = await Compass.isAvailable();\n  return available;\n};\n```\n\n### Read the current heading\n\nGet the most recent heading reading from the device's compass sensor. The result contains the magnetic heading, the true (geographic) heading if available, and the accuracy. Only available on Android and iOS:\n\n```typescript\nimport { Compass } from '@capawesome/capacitor-compass';\n\nconst getHeading = async () => {\n  const heading = await Compass.getHeading();\n  return heading;\n};\n```\n\n### Listen for heading changes\n\nCall `startHeadingUpdates()` to start emitting `headingChange` events and add a listener to receive continuous heading updates, for example to rotate a compass UI. Stop the updates when you no longer need them. Only available on Android and iOS:\n\n```typescript\nimport { Compass } from '@capawesome/capacitor-compass';\n\nconst startHeadingUpdates = async () => {\n  await Compass.startHeadingUpdates();\n};\n\nconst addHeadingChangeListener = async () => {\n  await Compass.addListener('headingChange', heading => {\n    console.log(heading);\n  });\n};\n\nconst stopHeadingUpdates = async () => {\n  await Compass.stopHeadingUpdates();\n};\n\nconst removeAllListeners = async () => {\n  await Compass.removeAllListeners();\n};\n```\n\n## API\n\n<docgen-index>\n\n* [`getHeading()`](#getheading)\n* [`isAvailable()`](#isavailable)\n* [`startHeadingUpdates()`](#startheadingupdates)\n* [`stopHeadingUpdates()`](#stopheadingupdates)\n* [`addListener('headingChange', ...)`](#addlistenerheadingchange-)\n* [`removeAllListeners()`](#removealllisteners)\n* [Interfaces](#interfaces)\n* [Type Aliases](#type-aliases)\n\n</docgen-index>\n\n<docgen-api>\n<!--Update the source file JSDoc comments and rerun docgen to update the docs below-->\n\n### getHeading()\n\n```typescript\ngetHeading() => Promise<GetHeadingResult>\n```\n\nGet the current device heading.\n\nThis method returns the most recent heading reading from the device's\ncompass sensor.\n\nOnly available on Android and iOS.\n\n**Returns:** <code>Promise&lt;<a href=\"#heading\">Heading</a>&gt;</code>\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### isAvailable()\n\n```typescript\nisAvailable() => Promise<IsAvailableResult>\n```\n\nCheck if the compass sensor is available on the device.\n\nOnly available on Android and iOS.\n\n**Returns:** <code>Promise&lt;<a href=\"#isavailableresult\">IsAvailableResult</a>&gt;</code>\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### startHeadingUpdates()\n\n```typescript\nstartHeadingUpdates() => Promise<void>\n```\n\nStart emitting `headingChange` events.\n\nOnly available on Android and iOS.\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### stopHeadingUpdates()\n\n```typescript\nstopHeadingUpdates() => Promise<void>\n```\n\nStop emitting `headingChange` events.\n\nOnly available on Android and iOS.\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### addListener('headingChange', ...)\n\n```typescript\naddListener(eventName: 'headingChange', listenerFunc: (event: HeadingChangeEvent) => void) => Promise<PluginListenerHandle>\n```\n\nAdd a listener for heading changes.\n\nOnly available on Android and iOS.\n\n| Param              | Type                                                            |\n| ------------------ | --------------------------------------------------------------- |\n| **`eventName`**    | <code>'headingChange'</code>                                    |\n| **`listenerFunc`** | <code>(event: <a href=\"#heading\">Heading</a>) =&gt; void</code> |\n\n**Returns:** <code>Promise&lt;<a href=\"#pluginlistenerhandle\">PluginListenerHandle</a>&gt;</code>\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### removeAllListeners()\n\n```typescript\nremoveAllListeners() => Promise<void>\n```\n\nRemove all listeners for this plugin.\n\nOnly available on Android and iOS.\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### Heading\n\n| Prop                  | Type                        | Description                                                                                                                                                                                                                                                                                                                                                                                                    | Since |\n| --------------------- | --------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----- |\n| **`accuracy`**        | <code>number \\| null</code> | The maximum deviation between the reported heading and the true heading in degrees. A negative value or `null` indicates that the accuracy is invalid or unknown.                                                                                                                                                                                                                                              | 0.1.0 |\n| **`magneticHeading`** | <code>number</code>         | The heading relative to magnetic north in degrees. The value ranges from `0` to `360`, where `0` means the device is pointing towards magnetic north.                                                                                                                                                                                                                                                          | 0.1.0 |\n| **`trueHeading`**     | <code>number \\| null</code> | The heading relative to true (geographic) north in degrees. The value ranges from `0` to `360`, where `0` means the device is pointing towards true north. Returns `null` if the true heading cannot be determined. On Android, this value is always `null`. On iOS, this value requires location services to be enabled and the `NSLocationWhenInUseUsageDescription` key to be set. Otherwise, it is `null`. | 0.1.0 |\n\n\n#### IsAvailableResult\n\n| Prop            | Type                 | Description                                            | Since |\n| --------------- | -------------------- | ------------------------------------------------------ | ----- |\n| **`available`** | <code>boolean</code> | Whether the compass sensor is available on the device. | 0.1.0 |\n\n\n#### PluginListenerHandle\n\n| Prop         | Type                                      |\n| ------------ | ----------------------------------------- |\n| **`remove`** | <code>() =&gt; Promise&lt;void&gt;</code> |\n\n\n### Type Aliases\n\n\n#### GetHeadingResult\n\n<code><a href=\"#heading\">Heading</a></code>\n\n\n#### HeadingChangeEvent\n\n<code><a href=\"#heading\">Heading</a></code>\n\n</docgen-api>\n\n## FAQ\n\n### How is this plugin different from other similar plugins?\n\nIt reads the device compass heading both on demand and as a continuous stream of updates, returning the magnetic heading, the accuracy, and — on iOS with location services — the true geographic heading. An `isAvailable()` check lets you confirm the sensor is present before you rely on it, and the whole surface is fully typed. It supports CocoaPods and Swift Package Manager on iOS and is actively maintained against the latest Capacitor version, giving you consistent heading data across Android and iOS.\n\n### What is the difference between the magnetic heading and the true heading?\n\nThe `magneticHeading` value is the heading relative to magnetic north, while the `trueHeading` value is the heading relative to true (geographic) north. Both range from `0` to `360` degrees. The magnetic heading is always available, whereas the true heading can only be determined on iOS and may be `null`.\n\n### Why is the `trueHeading` value always `null`?\n\nOn Android, the true heading is not supported and the value is always `null`. On iOS, reading the true heading requires location services to be enabled and the `NSLocationWhenInUseUsageDescription` key to be added to your app's `Info.plist` file, as described in the [Installation](#installation) section. If the key is missing or location permission is not granted, the value is `null`.\n\n### Does this plugin work on the Web?\n\nNo, this plugin is only available on Android and iOS. On the Web, all methods reject as unimplemented. You can use the `isAvailable()` method to check whether the compass sensor is available on the current device.\n\n### Do I need any permissions to read the compass heading?\n\nThe magnetic heading is available without any permission on both Android and iOS. Only if you also want to read the true (geographic) north heading on iOS, location services must be enabled and the `NSLocationWhenInUseUsageDescription` key must be present in your `Info.plist` file.\n\n### Can I use this plugin with Ionic, React, Vue or Angular?\n\nYes, the plugin is framework-agnostic. It works in any Capacitor app regardless of the web framework, including Ionic with Angular, React, or Vue, as well as plain JavaScript projects.\n\n## Related Plugins\n\n- [Accelerometer](https://capawesome.io/docs/sdks/capacitor/accelerometer/): Capture the acceleration force along the x, y, and z axes.\n- [Barometer](https://capawesome.io/docs/sdks/capacitor/barometer/): Obtain the static air pressure measured in hectopascals.\n- [Gyroscope](https://capawesome.io/docs/sdks/capacitor/gyroscope/): Read the device's gyroscope sensor.\n\n## Newsletter\n\nStay up to date with the latest news and updates about the Capawesome, Capacitor, and Ionic ecosystem by subscribing to our [Capawesome Newsletter](https://cloud.capawesome.io/newsletter/).\n\n## Changelog\n\nSee [CHANGELOG.md](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/compass/CHANGELOG.md).\n\n## License\n\nSee [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/compass/LICENSE).\n","readmeFilename":"README.md"}