Humidity Sensors in Mobile Apps

A practical guide to the rare on-device humidity sensor — how to read it on supported Android phones and how to fall back to weather APIs everywhere else.

Timothy Lindblom

Founder, Newly

A handful of Android devices ship with a relative humidity sensor — the original Galaxy S4, Note 4, a few ASUS phones, and a small number of rugged industrial devices. iPhones have never included one. This guide shows you what to do when it's present, and how to ship a humidity feature anyway.

Key Takeaways

  • Android exposes humidity (where present) via `Sensor.TYPE_RELATIVE_HUMIDITY`. iOS has no equivalent.
  • Always feature-detect — the sensor is missing on more than 95% of devices.
  • For broad reach, use a weather API + GPS to compute outdoor humidity instead.
  • Indoor humidity from the on-device sensor often reads several % off the user's wall-mounted hygrometer; treat it as an estimate.

Humidity Sensor at a Glance

%RH
Reported unit
<5%
Devices that include it
Android only
Direct access
No
Permission required

What It Is & How It Works

What it is. A capacitive humidity sensor measures the dielectric constant of a polymer film, which varies with absorbed water vapour. The OS exposes the result as relative humidity in percent.

How it works. On Android, register a listener for `TYPE_RELATIVE_HUMIDITY`. On iOS and on Android devices without the sensor, query a weather provider with the user's location.

Units & signal. Relative humidity in % (0–100). Combined with temperature you can derive absolute humidity, dew point, etc.

What You Can Build With It

Plant care apps

Show local humidity to advise on watering schedules.

Example: A houseplant assistant that ties humidity into its care plan.

Asthma and allergy tracking

Correlate symptoms with indoor or outdoor humidity readings.

Example: A respiratory health journal that logs humidity alongside peak-flow values.

Workshop and storage hints

Warn the user when humidity gets high enough to risk wood warping or condensation.

Example: A woodworker's assistant that flags days unsuitable for finishing.

Weather-augmented UIs

Pair humidity with a temperature feed for a richer environmental dashboard.

Example: A travel app that shows comfort indices for upcoming destinations.

Permissions & Setup

No permission required for the on-device sensor. Weather-API fallback needs location.

iOS · Info.plist

No special permission keys required.

Android · AndroidManifest.xml

No special permission keys required.

Code Examples

Setup

  • Expo: wrap a small native Android module, or call a weather API for cross-platform humidity
  • iOS: no on-device API; use a weather provider
  • Android: `Sensor.TYPE_RELATIVE_HUMIDITY` (API 14+) on supported devices
// Cross-platform fallback via weather API
import * as Location from 'expo-location';

export async function getHumidity(apiKey: string): Promise<number> {
  const { coords } = await Location.getCurrentPositionAsync({});
  const url = `https://api.openweathermap.org/data/2.5/weather?lat=${coords.latitude}&lon=${coords.longitude}&appid=${apiKey}`;
  const json = await fetch(url).then(r => r.json());
  return json.main.humidity as number; // %
}

Tip: With Newly, you describe the feature you want and the AI agent wires up the sensor, permissions, and UI for you. Try it free.

Best Practices

  • Always feature-detect

    Display a different UI on devices without the sensor instead of showing 0%.

  • Use weather-API humidity by default

    For 95%+ of devices, this is the only realistic source. Reserve the sensor for "indoor" overrides.

  • Combine with temperature for dew point

    Dew point is a better signal than raw humidity for "is it muggy?" or "will condensation form?" questions.

  • Smooth the reading

    On-device humidity sensors take 30–60 seconds to settle when conditions change.

Common Pitfalls

No iOS support

A "humidity" app on iPhone necessarily uses a weather API.

Mitigation: Be explicit in the UI that the value comes from a weather provider, not the device.

Phone in a pocket reads body humidity

The user's body adds 5–15% RH to the reading.

Mitigation: Suggest taking the phone out for 1 minute before trusting the reading.

Sensor drift

Humidity sensors drift several % over years.

Mitigation: Document this in your help screen; allow a manual offset.

When To Use It (And When Not To)

Good fit

  • Apps targeting users on devices known to include the sensor (rare but real)
  • Cross-platform humidity displays via a weather API
  • Plant care, allergy, woodworking and brewing apps
  • Comfort-index dashboards combining temperature + humidity

Look elsewhere if…

  • iOS-only apps that rely on on-device humidity
  • Apps that need consistent humidity values across devices
  • Sub-percent precision use cases
  • Estimating distance from breath, fog, etc.

Frequently Asked Questions

Which phones have a humidity sensor?

Mostly 2013-era Samsung devices (Galaxy S4, Note 3/4) and a small number of ASUS, Samsung Active and rugged industrial Android devices. No iPhone has one.

Why does my reading differ from a hygrometer?

Phone sensors take longer to equilibrate (30–60 seconds), and the user's body warmth in a pocket inflates the reading. Treat it as a rough estimate.

Should I show humidity in my app at all?

Only if it serves the user. If your audience is broad, ship a weather-API-backed display and skip the sensor altogether.

Can I infer humidity from other sensors?

No reliable derivation exists from accelerometer, mic or camera signals. Use a weather API.

Build with the Humidity Sensor on Newly

Ship a humidity sensor-powered feature this week

Newly turns a description like “use the humidity sensor to plant care apps into a real React Native app — permissions, native modules and UI included. Full source code is yours, and you can publish to the App Store and Google Play directly from the dashboard.

Start Building Your App

Want a deeper dive on the underlying APIs? See Expo Sensors, Apple Core Motion and Android sensor framework.

Continue Learning