This is an example Capacitor application demonstrating the @capgo/capacitor-light-sensor plugin.
- Check if light sensor is available
- Check and request permissions
- Start/stop light sensor monitoring
- Live light level display with visual indicator
- Get plugin version
# Install dependencies
bun install
# Build the web app
bun run build
# Add Android platform
npx cap add android
# Sync changes
npx cap sync
# Open in Android Studio
npx cap open androidbun run startNote: The light sensor only works on Android devices. On web/iOS, isAvailable() will return false.
- Build the web app:
bun run build - Sync:
npx cap sync - Open Android Studio:
npx cap open android - Run on a physical device (emulators may not have light sensor support)
- The light sensor is only available on Android devices
- Some Android emulators may not support the light sensor
- On Android 12+, update intervals below 200ms require the
HIGH_SAMPLING_RATE_SENSORSpermission