Solution: Traccar Client not sending locations in background on Motorola (Android 15)

Asty 21 days ago

I struggled with this for a while and finally found a solution that worked, so I'm sharing in case it helps others.
Symptoms:

Manual "Send location" worked fine
Automatic background updates stopped after a short time
All battery optimizations were disabled for the app
Background activity was allowed
Location permission set to "Allow all the time"
Wakelock enabled in Traccar settings
Stop Detection disabled, distance filter set to 0, heartbeat interval 60s

Diagnosis:
After enabling debug logs, I found this error repeating every time the heartbeat fired:
ERROR [FgsLaunchGate startService]
Failed to start foreground service: startForegroundService() not allowed
due to mAllowStartForeground false:
service org.traccar.client/com.transistorsoft.locationmanager.service.LocationRequestService

android.app.ForegroundServiceStartNotAllowedException
Android was silently blocking the app from starting its foreground service when the heartbeat alarm fired in the background, even though all the standard "battery optimization" settings looked correct in the UI. This is a restriction introduced in Android 12+ that isn't always exposed through normal settings menus.
Solution — grant foreground service permissions via ADB:

Enable Developer Options on the phone (tap Build Number 7 times)
Enable USB Debugging
Install ADB / Platform Tools on a computer
Connect the phone via USB and authorize the connection
Run these commands:

adb shell cmd appops set org.traccar.client START_FOREGROUND allow
adb shell cmd appops set org.traccar.client RUN_IN_BACKGROUND allow
adb shell cmd appops set org.traccar.client RUN_ANY_IN_BACKGROUND allow
adb shell dumpsys deviceidle whitelist +org.traccar.client

Toggle the Status switch in Traccar Client off and on to restart the service with the new permissions

After this, locations started flowing reliably every 60 seconds, even with the screen off and the app in the background for hours.
Device: Motorola g06 power Android 15

Hope this helps someone — the standard troubleshooting guide doesn't mention these hidden AppOps and they're invisible in regular system settings.

Asty 21 days ago

Following up on my previous post, the initial set of commands fixed the ForegroundServiceStartNotAllowedException, but after about an hour of the phone being stationary, a new error started appearing:

android.app.RemoteServiceException$ForegroundServiceDidNotStartInTimeException:
Context.startForegroundService() did not then call Service.startForeground()

The app was being throttled by Android's Doze Mode — heartbeat intervals were drifting from the configured 60s up to 2, 4, even 7 minutes between successful POSTs, and eventually the foreground service couldn't start fast enough (Android's 5-second limit) before getting killed.
The previous command list was incomplete. Here's the extended set I'm now using:

adb shell dumpsys deviceidle whitelist +org.traccar.client
adb shell cmd appops set org.traccar.client START_FOREGROUND allow
adb shell cmd appops set org.traccar.client RUN_IN_BACKGROUND allow
adb shell cmd appops set org.traccar.client RUN_ANY_IN_BACKGROUND allow
adb shell cmd appops set org.traccar.client INSTANT_APP_START_FOREGROUND allow
adb shell cmd appops set org.traccar.client SYSTEM_ALERT_WINDOW allow
adb shell cmd appops set org.traccar.client WAKE_LOCK allow
adb shell cmd appops set org.traccar.client SCHEDULE_EXACT_ALARM allow
adb shell dumpsys deviceidle disable
Anton Tananaev 21 days ago

Interesting. Why would foreground service be not allowed?

By the way, we're actively working on a new version of Traccar Client. It will be a fully open source without closed dependencies, so we'll have more control on what we can do. Hopefully it will help with some of these issues.

Kevin Powell 21 days ago

Thank you for providing this Asty! I've been having some random issues with Android killing the foreground service as well with the Traccar client on my Motorola Android 15's. Will give this a try on a couple of them and see if it helps.

Anton Tananaev 17 days ago

If you want to try, here's a preview version of a new Traccar Client:

https://traccar.nyc3.digitaloceanspaces.com/download/app-release.apk

Kevin Powell 14 days ago

Hi Anton - I've been trying the above preview version, and so far the tracking has been excellent. Did run into one bug though. My phone (Motorola Edge 2020 with Android 15) during the night, and when it came back up it looks like the Traccar client started fine, but then it started flooding location updates, sometimes a couple per minute. The phone was stationary all night. Here's the beginning of the logs of the incident:

2026-06-02 16:13:21 Network online
2026-06-02 16:31:35 Using FusedLocationProvider
2026-06-02 16:31:35 Request position https://gps.domain.com Device-ID-Here
2026-06-02 16:31:38 Upload response 200
2026-06-02 21:39:47 Restarting service after android.intent.action.BOOT_COMPLETED
2026-06-02 21:39:47 Service created
2026-06-02 21:39:47 Acquiring wakelock
2026-06-02 21:39:47 Using FusedLocationProvider
2026-06-02 21:39:47 Engine started
2026-06-02 21:39:47 Activity transition updates registered
2026-06-02 21:39:50 Location accepted xx.8876132,-xxx..8849828
2026-06-02 21:39:50 Location filtered xx.8876132,-xxx..8849828
2026-06-02 21:39:50 Upload response 200
2026-06-02 22:31:43 Location accepted xx.8875978,-xxx..884797
2026-06-02 22:31:43 Location accepted xx.8876013,-xxx..884968
2026-06-02 22:31:44 Upload response 200
2026-06-02 22:31:44 Upload response 200
2026-06-02 23:12:18 Location accepted xx.8876286,-xxx..8848416
2026-06-02 23:12:18 Upload response 200
2026-06-02 23:12:45 Location accepted xx.8876903,-xxx..8849387
2026-06-02 23:12:45 Upload response 200
2026-06-02 23:13:23 Location accepted xx.8876689,-xxx..8851348
2026-06-02 23:13:23 Upload response 200
2026-06-02 23:13:24 Location accepted xx.8876234,-xxx..8849923
2026-06-02 23:13:24 Upload response 200
2026-06-02 23:16:53 Location accepted xx.8875321,-xxx..8849763
2026-06-02 23:16:53 Upload response 200
2026-06-02 23:17:08 Location accepted xx.8876241,-xxx..8849838
2026-06-02 23:17:08 Upload response 200
2026-06-02 23:18:11 Location accepted xx.8875884,-xxx..8848729
2026-06-02 23:18:11 Upload response 200
2026-06-02 23:18:39 Location accepted xx.8875604,-xxx..8849894
2026-06-02 23:18:39 Upload response 200
2026-06-02 23:19:17 Location accepted xx.8876249,-xxx..8849034
2026-06-02 23:19:17 Upload response 200
2026-06-02 23:19:45 Location accepted xx.8875639,-xxx..8849935
2026-06-02 23:19:45 Upload response 200
2026-06-02 23:20:16 Location accepted xx.8875811,-xxx..8848709
2026-06-02 23:20:16 Upload response 200
2026-06-02 23:20:42 Location accepted xx.887639,-xxx..8849657
2026-06-02 23:20:42 Upload response 200
2026-06-02 23:21:42 Location accepted xx.8875689,-xxx..8850563
2026-06-02 23:21:42 Upload response 200
2026-06-02 23:22:32 Location accepted xx.8876403,-xxx..8849746
2026-06-02 23:22:32 Upload response 200
2026-06-03 00:14:28 Location accepted xx.8875493,-xxx..8849647
2026-06-03 00:14:29 Upload response 200
2026-06-03 00:16:38 Location accepted xx.8876927,-xxx..8849644
2026-06-03 00:16:39 Upload response 200
2026-06-03 00:16:50 Location accepted xx.8875987,-xxx..8849732
2026-06-03 00:16:50 Upload response 200
2026-06-03 00:40:53 Location accepted xx.8875925,-xxx..8851042
2026-06-03 00:40:53 Upload response 200
2026-06-03 00:40:54 Location accepted xx.8876067,-xxx..8849853
2026-06-03 00:40:54 Upload response 200
2026-06-03 00:41:03 Location accepted xx.8876249,-xxx..8848261
2026-06-03 00:41:03 Upload response 200
2026-06-03 00:41:05 Location accepted xx.8876044,-xxx..8849768
2026-06-03 00:41:05 Upload response 200
2026-06-03 00:44:21 Location accepted xx.8875948,-xxx..8848234
2026-06-03 00:44:21 Upload response 200
2026-06-03 00:44:22 Location accepted xx.8875899,-xxx..8849588
2026-06-03 00:44:22 Upload response 200
2026-06-03 01:02:31 Location accepted xx.8876451,-xxx..8850665
2026-06-03 01:02:31 Upload response 200
2026-06-03 01:04:32 Location accepted xx.8876073,-xxx..8848373
2026-06-03 01:04:32 Upload response 200
2026-06-03 01:04:34 Location accepted xx.8876039,-xxx..8849677
2026-06-03 01:04:34 Upload response 200
2026-06-03 01:06:07 Location accepted xx.8875079,-xxx..8849004
2026-06-03 01:06:07 Upload response 200
2026-06-03 01:06:09 Location accepted xx.8876087,-xxx..8849826
2026-06-03 01:06:09 Upload response 200
2026-06-03 01:19:20 Location accepted xx.8875383,-xxx..8848913
2026-06-03 01:19:21 Upload response 200
2026-06-03 01:19:22 Location accepted xx.8876077,-xxx..8849818
2026-06-03 01:19:22 Upload response 200
2026-06-03 01:29:24 Location accepted xx.8876171,-xxx..8851396
2026-06-03 01:29:24 Upload response 200
2026-06-03 01:29:26 Location accepted xx.8876081,-xxx..8849791
2026-06-03 01:29:26 Upload response 200
2026-06-03 01:31:36 Location accepted xx.8876244,-xxx..8851242
2026-06-03 01:31:36 Location accepted xx.8876089,-xxx..8849702
2026-06-03 01:31:36 Upload response 200
2026-06-03 01:31:36 Upload response 200
2026-06-03 01:38:34 Location accepted xx.8875268,-xxx..8848293
2026-06-03 01:38:35 Location accepted xx.8876053,-xxx..8849671
2026-06-03 01:38:35 Upload response 200
2026-06-03 01:38:35 Upload response 200
2026-06-03 03:23:59 Location accepted xx.887505,-xxx..8850733
2026-06-03 03:24:00 Upload response 200
2026-06-03 03:24:00 Location accepted xx.8876053,-xxx..884987
2026-06-03 03:24:00 Upload response 200
2026-06-03 03:40:44 Location accepted xx.8876105,-xxx..8848536
2026-06-03 03:40:44 Upload response 200
2026-06-03 03:41:05 Location accepted xx.8876008,-xxx..8849727
2026-06-03 03:41:05 Upload response 200

etc, etc...

Again, the phone remained in the same place all night. I am running my own server which is version 6.13.3. The only way I was able to get it to stop was to walk the phone around more than my 10 meter threshold, then it finally did:
Activity Transition: still/exit, walking enter

Then it went back to:

Activity Transition: walking/exit, still/enter - after I put the phone back down, and it's been fine since.

I understand it's a beta application, but just wanted to let you know.

Thanks!

Anton Tananaev 14 days ago

Interesting. It looks like your phone rebooted. Is that correct?

Kevin Powell 14 days ago

Yes, sorry I see I managed to not get that typed correctly in my message. I rebooted the phone and went to bed. When I woke up battery was at 40% and all those location updates were flooding. It's like Traccar wasn't able to determine the phone was stationary after the reboot and defaulted to just sending location updates or something.

Let me know if you need any more info, glad to help any way I can.

Anton Tananaev 11 days ago
Kevin Powell 11 days ago

This appears to be the exact same apk you linked to a few days ago? (The SHA256 matches for both downloads) So I already am running the new version.

And it does always start the location flooding every time I reboot the phone. Only way to get it to stop is to get the phone to enter a different state, which I do by walking it around a bit. Once it registers "walking/enter" then I can stop and it registers "still/enter" just fine, and appears to work correctly from there on out.

Anton Tananaev 11 days ago

It should be different APK. There might be some caching though.

Anton Tananaev 11 days ago

Just in case, here's another link you can use:

https://www.dropbox.com/t/Am83jDZb3hAJWQBV

Kevin Powell 9 days ago

Got the new version working, and the boot problem seems resolved. Thanks!