{"_id":"@capawesome/capacitor-proximity-sensor","_rev":"4-1031c631f113bfb31726d868f8f437da","name":"@capawesome/capacitor-proximity-sensor","dist-tags":{"latest":"0.1.2"},"versions":{"0.0.1":{"name":"@capawesome/capacitor-proximity-sensor","version":"0.0.1","keywords":["capacitor","plugin","native"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-proximity-sensor@0.0.1","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/proximity-sensor/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"67627d6e669b8983960fd82aab1727eb66bb2e74","tarball":"https://registry.npmjs.org/@capawesome/capacitor-proximity-sensor/-/capacitor-proximity-sensor-0.0.1.tgz","fileCount":37,"integrity":"sha512-GtdYDE8yzg1DlwzLsRXXtrKLsOPpq5TZaudtyyrR+TtXzGM24D5cz7QTSb8oQINy/sEJ1hted/cqWW6JaUVOxw==","signatures":[{"sig":"MEUCIGlQmetCZJW/opDLprTWOws3DvJOXMpDbG5PF4AWRQ4RAiEA38N2oLShPYDOtr9x7igwGyf84GVXtUXTD729kvN/J5I=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":54705},"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":"a8c9e0f3c4687c6a9f4fc7554f3dc79536ad5154","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 ProximitySensorPlugin --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 to read the device's proximity sensor.","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-proximity-sensor_0.0.1_1783449382779_0.3357004904300003","host":"s3://npm-registry-packages-npm-production"}},"0.1.0":{"name":"@capawesome/capacitor-proximity-sensor","version":"0.1.0","keywords":["capacitor","plugin","native","capacitor-plugin","proximity sensor","proximity","sensor","proximity detection","near detection","distance sensor"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-proximity-sensor@0.1.0","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/proximity-sensor/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"02907acae4e3be68779fa1b3485e2a1f1e7ae80a","tarball":"https://registry.npmjs.org/@capawesome/capacitor-proximity-sensor/-/capacitor-proximity-sensor-0.1.0.tgz","fileCount":37,"integrity":"sha512-KdUBxWYP7Asl35x35FU6C4AEh6YrV+taUk1QSY0GO08LpUI6dmFy/Zm4inP4NsQPO/f0NJi8MLzVSPluReTssQ==","signatures":[{"sig":"MEUCIQCT5Aom9hxdKMyV6LJZFZFnNX65rtsP84C0fYiRuJOR4QIgALx1O6vUM4fqKQplbZah1RhgHJap6C//yOK9oynxeUM=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-proximity-sensor@0.1.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":58889},"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 ProximitySensorPlugin --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:c6e4f312-2b57-4b8c-870d-7b588f1eeac8"}},"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 to read the device's proximity sensor 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-proximity-sensor_0.1.0_1784015577921_0.03441825901339057","host":"s3://npm-registry-packages-npm-production"}},"0.1.1":{"name":"@capawesome/capacitor-proximity-sensor","version":"0.1.1","keywords":["capacitor","plugin","native","capacitor-plugin","proximity sensor","proximity","sensor","proximity detection","near detection","distance sensor"],"author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"license":"MIT","_id":"@capawesome/capacitor-proximity-sensor@0.1.1","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"homepage":"https://capawesome.io/docs/sdks/capacitor/proximity-sensor/","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"0a3e7062b0585da9d88d27186258838b4f457d41","tarball":"https://registry.npmjs.org/@capawesome/capacitor-proximity-sensor/-/capacitor-proximity-sensor-0.1.1.tgz","fileCount":37,"integrity":"sha512-gDOyrajOj90nENwgwtYNpPHrArGNBh6LppMZGiZyIwc5JzdMndSyY7zWD89Ilc0eAw5CtbArOfQQjPDkV2FfSg==","signatures":[{"sig":"MEUCIQDKDVhdy1gkQzuy+usAKW/fCp/4qIpgnL3VVu+KvNUPawIgUXkMpQcHr9uBT78x33I7ZydmF9GcBm50cNCqxuF1hps=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-proximity-sensor@0.1.1","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":58898},"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 ProximitySensorPlugin --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:c6e4f312-2b57-4b8c-870d-7b588f1eeac8"}},"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 to read the device's proximity sensor 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-proximity-sensor_0.1.1_1784103032266_0.9752462052611668","host":"s3://npm-registry-packages-npm-production"}},"0.1.2":{"_id":"@capawesome/capacitor-proximity-sensor@0.1.2","bugs":{"url":"https://github.com/capawesome-team/capacitor-plugins/issues"},"dist":{"shasum":"7a3f4a036a25ed93d4f695eff0a10ab4b671be78","tarball":"https://registry.npmjs.org/@capawesome/capacitor-proximity-sensor/-/capacitor-proximity-sensor-0.1.2.tgz","fileCount":37,"integrity":"sha512-4VhX+flKmZScSTpXhM5+M7Np6vyptYqFIKYdymx/9nspIx5TXbxT6F/DuHsgSqI2dpil1Xd8tDb4fHTO7nonUg==","signatures":[{"sig":"MEUCIQCsf/L1gNh+9eY6TT6wPYwRscYmxkmMsjws3t49wW5uQwIgFP7bhh5+DvYfdk7AsBl9A+qojW8dEXt+IuiCrfsFnEE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQCd/bLl/flAbSw1/aYnH0oEEs2fvZHEZnvWLM743+PuwwIgMS81+sxEnWzwjtcRxM+psU8x0chPIVeUq9UFdsXoWsU="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/@capawesome%2fcapacitor-proximity-sensor@0.1.2","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":58964},"main":"dist/plugin.cjs.js","name":"@capawesome/capacitor-proximity-sensor","types":"dist/esm/index.d.ts","unpkg":"dist/plugin.js","author":{"name":"Robin Genz","email":"mail@robingenz.dev"},"module":"dist/esm/index.js","funding":[{"url":"https://github.com/sponsors/capawesome-team/","type":"github"},{"url":"https://opencollective.com/capawesome","type":"opencollective"}],"gitHead":"7c1937ed10b7de86ca2c1cdc3539a2735fd69a00","license":"MIT","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 ProximitySensorPlugin --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 .."},"version":"0.1.2","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:c6e4f312-2b57-4b8c-870d-7b588f1eeac8"}},"homepage":"https://capawesome.io/docs/sdks/capacitor/proximity-sensor/","keywords":["capacitor","plugin","native","capacitor-plugin","proximity sensor","proximity","sensor","proximity detection","near detection","distance sensor"],"capacitor":{"ios":{"src":"ios"},"android":{"src":"android"}},"repository":{"url":"git+https://github.com/capawesome-team/capacitor-plugins.git","type":"git"},"_npmVersion":"11.17.0","description":"Capacitor plugin to read the device's proximity sensor on Android and iOS.","directories":{},"maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"_nodeVersion":"24.19.0","eslintConfig":{"extends":"@ionic/eslint-config/recommended"},"publishConfig":{"access":"public"},"_hasShrinkwrap":false,"devDependencies":{"eslint":"8.57.0","rimraf":"6.1.2","rollup":"4.62.3","swiftlint":"2.0.0","typescript":"5.9.3","@capacitor/cli":"8.4.2","@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.9.7"},"peerDependencies":{"@capacitor/core":">=8.0.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/capacitor-proximity-sensor_0.1.2_1788337560516_0.7180101949258575"}}},"time":{"created":"2026-07-07T18:36:22.649Z","modified":"2026-09-02T08:26:01.228Z","0.0.1":"2026-07-07T18:36:23.008Z","0.1.0":"2026-07-14T07:52:58.041Z","0.1.1":"2026-07-15T08:10:32.431Z","0.1.2":"2026-09-02T08:26:00.669Z"},"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/proximity-sensor/","keywords":["capacitor","plugin","native","capacitor-plugin","proximity sensor","proximity","sensor","proximity detection","near detection","distance sensor"],"repository":{"url":"git+https://github.com/capawesome-team/capacitor-plugins.git","type":"git"},"description":"Capacitor plugin to read the device's proximity sensor on Android and iOS.","maintainers":[{"name":"robingenz","email":"mail@robingenz.dev"}],"readme":"# Capacitor Proximity Sensor Plugin\n\nCapacitor plugin to read the device's proximity sensor.\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\nThe Capacitor Proximity Sensor plugin is one of the most complete proximity sensing solutions for Capacitor apps. Here are some of the key features:\n\n- 🖥️ **Cross-platform**: Supports Android and iOS.\n- 📏 **Proximity detection**: Detect whether an object is close to the screen.\n- ⚡ **Real-time updates**: Continuous proximity data with event listeners.\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 Proximity Sensor plugin is typically used to react when an object is close to the device's screen, for example:\n\n- **Calling and VoIP apps**: Detect when the user holds the device to their ear during a call.\n- **Pocket detection**: Detect when the device is in a pocket or bag to ignore accidental input.\n- **Proximity-triggered actions**: Start or stop app behavior based on real-time `measurement` events.\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 proximity events pair with the Light Sensor in call and media apps that adapt to the environment.\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-proximity-sensor` 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-proximity-sensor\nnpx cap sync\n```\n\n### Android\n\n#### Proguard\n\nIf you are using Proguard, you need to add the following rules to your `proguard-rules.pro` file:\n\n```\n-keep class io.capawesome.capacitorjs.plugins.** { *; }\n```\n\n## Configuration\n\nNo configuration required for this plugin.\n\n## Usage\n\nThe following examples show how to check whether the proximity sensor is available, get a single measurement, and start and stop continuous measurement updates.\n\n### Check whether the sensor is available\n\nNot every device has a proximity sensor, so check its availability first. Only available on Android and iOS:\n\n```typescript\nimport { ProximitySensor } from '@capawesome/capacitor-proximity-sensor';\n\nconst isAvailable = async () => {\n  const result = await ProximitySensor.isAvailable();\n  return result.available;\n};\n```\n\n### Get a single measurement\n\nRead the most recent measurement from the proximity sensor. Note that on iOS, reading the measurement enables proximity monitoring, which turns off the screen while an object is close to the sensor (see [Screen Dimming (iOS)](#screen-dimming-ios)):\n\n```typescript\nimport { ProximitySensor } from '@capawesome/capacitor-proximity-sensor';\n\nconst getMeasurement = async () => {\n  const measurement = await ProximitySensor.getMeasurement();\n  console.log('Near: ', measurement.near);\n  console.log('Distance: ', measurement.distance);\n};\n```\n\n### Start and stop measurement updates\n\nListen for continuous `measurement` events. On iOS, proximity monitoring stays enabled until `stopMeasurementUpdates()` (or `removeAllListeners()`) is called:\n\n```typescript\nimport { ProximitySensor } from '@capawesome/capacitor-proximity-sensor';\n\nconst startMeasurementUpdates = async () => {\n  await ProximitySensor.addListener('measurement', measurement => {\n    console.log('Near: ', measurement.near);\n    console.log('Distance: ', measurement.distance);\n  });\n  await ProximitySensor.startMeasurementUpdates();\n};\n\nconst stopMeasurementUpdates = async () => {\n  await ProximitySensor.stopMeasurementUpdates();\n};\n\nconst removeAllListeners = async () => {\n  await ProximitySensor.removeAllListeners();\n};\n```\n\n## API\n\n<docgen-index>\n\n* [`getMeasurement()`](#getmeasurement)\n* [`isAvailable()`](#isavailable)\n* [`startMeasurementUpdates()`](#startmeasurementupdates)\n* [`stopMeasurementUpdates()`](#stopmeasurementupdates)\n* [`addListener('measurement', ...)`](#addlistenermeasurement-)\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### getMeasurement()\n\n```typescript\ngetMeasurement() => Promise<GetMeasurementResult>\n```\n\nGet the latest measurement.\n\nThis method returns the most recent measurement from the proximity sensor.\n\nOn iOS, reading the measurement enables proximity monitoring, which turns\noff the screen while an object is close to the sensor.\n\nOnly available on Android and iOS.\n\n**Returns:** <code>Promise&lt;<a href=\"#measurement\">Measurement</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 proximity 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### startMeasurementUpdates()\n\n```typescript\nstartMeasurementUpdates() => Promise<void>\n```\n\nStart emitting `measurement` events.\n\nOn iOS, this enables proximity monitoring, which turns off the screen\nwhile an object is close to the sensor.\n\nOnly available on Android and iOS.\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### stopMeasurementUpdates()\n\n```typescript\nstopMeasurementUpdates() => Promise<void>\n```\n\nStop emitting `measurement` events.\n\nOn iOS, this disables proximity monitoring.\n\nOnly available on Android and iOS.\n\n**Since:** 0.1.0\n\n--------------------\n\n\n### addListener('measurement', ...)\n\n```typescript\naddListener(eventName: 'measurement', listenerFunc: (event: MeasurementEvent) => void) => Promise<PluginListenerHandle>\n```\n\nCalled when a new measurement is available.\n\nOnly available on Android and iOS.\n\n| Param              | Type                                                                    |\n| ------------------ | ----------------------------------------------------------------------- |\n| **`eventName`**    | <code>'measurement'</code>                                              |\n| **`listenerFunc`** | <code>(event: <a href=\"#measurement\">Measurement</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\n**Since:** 0.1.0\n\n--------------------\n\n\n### Interfaces\n\n\n#### Measurement\n\n| Prop           | Type                        | Description                                                                                                                                                                                                                                                              | Since |\n| -------------- | --------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----- |\n| **`distance`** | <code>number \\| null</code> | The distance between the sensor and the nearby object in centimeters (cm). Most devices only report whether an object is near or far, so this value is typically either `0` (near) or the sensor's maximum range (far). Only available on Android. Always `null` on iOS. | 0.1.0 |\n| **`near`**     | <code>boolean</code>        | Whether an object is close to the sensor.                                                                                                                                                                                                                                | 0.1.0 |\n\n\n#### IsAvailableResult\n\n| Prop            | Type                 | Description                                              | Since |\n| --------------- | -------------------- | -------------------------------------------------------- | ----- |\n| **`available`** | <code>boolean</code> | Whether the proximity 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#### GetMeasurementResult\n\n<code><a href=\"#measurement\">Measurement</a></code>\n\n\n#### MeasurementEvent\n\n<code><a href=\"#measurement\">Measurement</a></code>\n\n</docgen-api>\n\n## Screen Dimming (iOS)\n\nOn iOS, reading the proximity sensor requires enabling proximity monitoring via `UIDevice`. While monitoring is enabled, iOS automatically turns off the screen whenever an object (such as the user's ear or a hand) is close to the sensor, exactly like during a phone call. This is a system-level behavior that cannot be disabled.\n\nFor this reason, monitoring is only enabled while it is needed:\n\n- `getMeasurement()` enables monitoring, reads the current state and disables it again.\n- `startMeasurementUpdates()` keeps monitoring enabled until `stopMeasurementUpdates()` (or `removeAllListeners()`) is called.\n\nOnly call `startMeasurementUpdates()` when you actually want this behavior.\n\nOn Android, reading the proximity sensor has no effect on the screen.\n\n## FAQ\n\n### How is this plugin different from other similar plugins?\n\nIt covers the whole proximity story through one fully typed API: a one-time reading, continuous real-time `measurement` events, and an availability check, working consistently across Android and iOS. It surfaces platform specifics honestly — a distance in centimeters on Android and the near/far state on iOS — and documents the iOS screen-dimming behavior so there are no surprises. The package is kept current with the latest Capacitor version and ships for both CocoaPods and Swift Package Manager.\n\n### Why does the screen turn off on iOS when reading the sensor?\n\nOn iOS, reading the proximity sensor requires enabling proximity monitoring via `UIDevice`. While monitoring is enabled, iOS automatically turns off the screen whenever an object is close to the sensor, exactly like during a phone call. This is a system-level behavior that cannot be disabled. See the [Screen Dimming (iOS)](#screen-dimming-ios) section for details.\n\n### Why is the `distance` value always `null` on iOS?\n\niOS only reports whether an object is near the sensor via the `near` property. The `distance` value in centimeters is only available on Android and is always `null` on iOS.\n\n### Why is the `distance` value always either `0` or the maximum range on Android?\n\nMost devices only report whether an object is near or far instead of an exact distance. The `distance` value is therefore typically either `0` (near) or the sensor's maximum range (far).\n\n### How can I check whether a device has a proximity sensor?\n\nCall the `isAvailable()` method before using the sensor. It returns whether the proximity sensor is available on the device.\n\n### Does this plugin work on the Web?\n\nNo, this plugin is only available on Android and iOS, since browsers do not expose the device's proximity sensor.\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 in hectopascals (hPa).\n- [Gyroscope](https://capawesome.io/docs/sdks/capacitor/gyroscope/): Read the device's gyroscope sensor.\n- [Light Sensor](https://capawesome.io/docs/sdks/capacitor/light-sensor/): Read the device's ambient light 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/proximity-sensor/CHANGELOG.md).\n\n## License\n\nSee [LICENSE](https://github.com/capawesome-team/capacitor-plugins/blob/main/packages/proximity-sensor/LICENSE).\n","readmeFilename":"README.md"}