MerginMaps / MerginMaps/mobile

Position tracking stops recording while the screen is off on Android

Open
#4,588 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug position tracking
Dominant language
C++
Stars
388
Forks
87
Avg merge
2d 7h
Merged PRs (30d)
20

Description

**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)
(Samsung A56,  Motorola One Action)

**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 tracking.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the Position tracking entry point and inspect the Android manifest, foreground-service setup, runtime permission flow, and lifecycle behavior when the screen locks. Reproduce on Android 12 or newer using the listed Samsung or Motorola devices, then verify that coordinates continue recording with the notification visible until Stop tracking is tapped.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.