Skip to content

Position tracking stops recording while the screen is off on Android #4588

Description

@VitorVieiraZ

Description
During Position tracking on Android, the app stops recording coordinates as soon as the screen turns off (display timeout or device lock) and resumes when the screen is on again. The recorded track shows a gap for the whole period the screen was off. The manifest already declares the location foreground service pieces (FOREGROUND_SERVICE_LOCATION), so this looks like a runtime or lifecycle issue rather than only a missing permission.
Reported by @lmotta

Environment
Production

Application (+ app version, build, operating system)
Android, Samsung device (Android 12 or newer)

Steps to reproduce

  1. Open a project with tracking enabled.
  2. Start Position tracking from the app (button tap, app in the foreground).
  3. Move so coordinates are recorded, and confirm the tracking notification is shown.
  4. Let the screen turn off or lock the device.
  5. Keep moving for several minutes, turn the screen back on, and inspect the track.

Actual results
Recording pauses while the screen is off, the track has a gap, and it only resumes when the screen is turned back on.

Expected results
Tracking keeps recording continuously while the screen is off, with the notification visible, until Stop tracking is tapped.

Likely root causes

A few possibilities that might be worth checking:

  1. No wake lock during a tracking session. The manifest does not declare WAKE_LOCK, so when the device enters Doze with the screen off, CPU may sleep between fixes and updates could pause.
  2. OEM battery optimization. On Samsung in particular, the tracking process may be getting suspended while the screen is off, since MM does not seem to request an exemption from battery optimization.
  3. Background location permission. ACCESS_BACKGROUND_LOCATION is not declared, so the system permission screen only offers up to "Allow while using the app" and never "Allow all the time". It might be worth declaring it and requesting it at runtime, so users can grant constant location access for field tracking.

Metadata

Metadata

Assignees

No one assigned

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions