home-assistant / home-assistant/android

Background location updates stop working after extended periods, despite correct permissions — cross-platform (Android + iOS)

Open
#7,143 0 comments 1 reaction 0 assignees View on GitHub
bug location-tracking
Dominant language
Kotlin
Stars
3.9k
Forks
1.1k
Avg merge
1d 12h
Merged PRs (30d)
81

Description

Description:
We're observing unreliable background location reporting to the Home Assistant server from the Companion App, affecting both Android and iOS devices in the same household, which points to an app-level issue rather than an OS/manufacturer-specific one.
Devices affected:

Android: Xiaomi POCO F6 Pro (HyperOS/MIUI)
iOS: iPhone (recent iOS version)

Symptoms:

The device_tracker entity for both devices frequently freezes on "home" for extended periods (observed: several hours up to 24+ hours) even though the device has physically left the home zone.
A third-party location-sharing app (iSharing) installed on the same devices reports the correct, live location throughout — confirming GPS, OS-level location permissions, and network connectivity are all functioning correctly on both devices.
Router-based (WiFi) presence detection (FRITZ!Box device_tracker) correctly reflects departure/return in near real-time, in contrast to the GPS-based Companion App tracker.

Already verified/ruled out:

Location permission set to "Always"/"Allow all the time" on both platforms
Precise location enabled (iOS) / Precise location enabled (Android 12+)
Battery optimization disabled for the app (Android)
Autostart enabled (Android/MIUI-specific setting)
Background App Refresh enabled with Wi-Fi & Cellular (iOS)
Companion App → Manage Sensors → "Background Location", "Location Zone", "Single Accurate Location" all explicitly enabled
Triggered notify.mobile_app_ with {"message": "command_update_location"} from a Home Assistant automation (confirmed via automation trace that the notify action executed successfully) — device_tracker still did not update on several occasions

Expected behavior: Location updates should be sent to the HA server reliably in the background, matching what a comparable third-party location-sharing app achieves on the same device.
Actual behavior: Location updates stop for extended, unpredictable periods on both platforms, with no error shown in the app.
Additional context: Happy to provide app logs/diagnostics if useful for debugging.

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start by reproducing the background update failure with the listed sensor settings and the command_update_location notification, then collect the app logs or diagnostics offered by the reporter. Done means identifying why updates stop and verifying reliable background location reporting on the affected platforms.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, ios, kotlin
Domain
mobile-dev
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.