Menu

How I built true background step counting in React 19.2 + Capacitor on Android 14/15 (without Google Fit, which is shutting down)
📰

How I built true background step counting in React 19.2 + Capacitor on Android 14/15 (without Google Fit, which is shutting down)

DEV Community: react·Euexia·3 days ago
#NvVmVUvc
#devtoreact#devto#dev#service#sensor
Reading 0:00
15s threshold

Try it first (no signup): https://drive.google.com/file/d/1EKtKC2EAY_9EKt6VZ-XZj3y36orUPMzw/view?usp=sharing

euexia-demo.apk is 10.6 MB and comes pre-seeded with 8,432 steps, a 517 cal flame streak, and seven days of charts. Swipe it closed, walk 20-30 steps, then pull down the notification shade. The count keeps rising while the app is gone.

The problem

Every React/Capacitor health template I looked at did the same thing: call Google Fit, read today's steps, render a ring. It works until the app is killed. Then the WebView is gone, the polling stops, and the number freezes.

Google is also winding Fit down in favour of Health Connect, so building a new paid product on that API in 2026 is a bad bet.

The hardware can already count steps without the app running. Android exposes Sensor.TYPE_STEP_COUNTER , a low-power sensor-hub counter that keeps ticking at the firmware level.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.