Location tracking is driving me insane

there is still something very strange going on. Every received location update event should be followed by the coordinates and the decsion making process. It looks like you are getting updates without any location at all at times. HA will not be udpated until you see a log statement for location update sent.

Geocoded location merely takes the GPS coordinates and feeds it into a google api, it is not meant to be used for location tracking jsut to print a pretty address of the coordinates.

on play certified devices we don’t see these issues I believe these gapps are missing a lot of important features that are part of play services which the app uses.

I’m sure you’re right there, still on my old device with the same custom ROM everything turned out to be working at some point (of which I just can’t seem to recall the steps for the sake of all). I remember having a lot of struggle there, however eventually I figured it out.

I would like to use this thread to create a diary of steps to take to get this working. I’m quite sure I’m not the only one who wants to make this app run appropriately including location tracking on a custom ROM.

BTW I haven’t changed any configuration in the last few minutes and apparently the location tracker seems to be jumping between my location and my old address now (have a look at the longitude coordinates; the yy.788*** being the deprecated ones):

02-02 23:33:54.912 23475 23475 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-02 23:33:55.158 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.581460 hAcc=6593.0 et=+1d1h49m41s488ms {Bundle[EMPTY_PARCEL]}]
02-02 23:33:55.158 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 1 of 5
02-02 23:34:02.549 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.581460 hAcc=6593.0 et=+1d1h49m48s880ms {Bundle[EMPTY_PARCEL]}]
02-02 23:34:02.549 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 2 of 5
02-02 23:34:12.559 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.581460 hAcc=6593.0 et=+1d1h49m58s890ms {Bundle[EMPTY_PARCEL]}]
02-02 23:34:12.559 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 3 of 5
02-02 23:34:22.559 23475 23475 D LocBroadcastReceiver: Received location update.
...
02-02 23:34:22.574 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.581460 hAcc=6593.0 et=+1d1h50m8s893ms {Bundle[EMPTY_PARCEL]}]
02-02 23:34:22.574 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 4 of 5
02-02 23:34:22.575 23475 23475 D LocBroadcastReceiver: Received location update.
...
02-02 23:35:22.573 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.581460 hAcc=6593.0 et=+1d1h51m8s889ms {Bundle[EMPTY_PARCEL]}]
02-02 23:35:22.573 23475 23475 D LocBroadcastReceiver: No location was accurate enough, sending our last location anyway
02-02 23:37:23.559 23475 23475 D LocBroadcastReceiver: Received location update.
...
02-02 23:38:32.944 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.788523 hAcc=14.960491 et=+1d1h53m9s893ms {Bundle[EMPTY_PARCEL]}]
02-02 23:38:32.944 23475 23475 D LocBroadcastReceiver: Location accurate enough, all done with high accuracy.
02-02 23:38:32.945 23475 23475 D LocBroadcastReceiver: Last Location: 
02-02 23:38:32.945 23475 23475 D LocBroadcastReceiver: Coords:(xx.xxxxxx, yy.7885231)
02-02 23:38:32.945 23475 23475 D LocBroadcastReceiver: Accuracy: 14.960491
02-02 23:38:32.945 23475 23475 D LocBroadcastReceiver: Bearing: 0.0
02-02 23:38:32.951 23475 23475 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
02-02 23:38:32.952 23475 23475 D LocBroadcastReceiver: Received location that is 69400 milliseconds old, 1675377443551 compared to 1675377512951 with source fused
02-02 23:38:33.029 23475 27643 D LocBroadcastReceiver: Location update sent successfully as exact
02-02 23:38:33.445 23475 23475 D LocBroadcastReceiver: Received location update.
...
02-02 23:38:33.463 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.788536 hAcc=10.0 et=+1d1h54m19s780ms {Bundle[EMPTY_PARCEL]}]
02-02 23:38:33.463 23475 23475 D LocBroadcastReceiver: Location accurate enough, all done with high accuracy.
02-02 23:38:33.464 23475 23475 D LocBroadcastReceiver: Last Location: 
02-02 23:38:33.464 23475 23475 D LocBroadcastReceiver: Coords:(xx.xxxxxx, yy.7885357)
02-02 23:38:33.464 23475 23475 D LocBroadcastReceiver: Accuracy: 10.0
02-02 23:38:33.464 23475 23475 D LocBroadcastReceiver: Bearing: 0.0
02-02 23:38:33.468 23475 23475 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
02-02 23:38:33.469 23475 23475 D LocBroadcastReceiver: Received location that is 31 milliseconds old, 1675377513437 compared to 1675377513468 with source fused
02-02 23:38:33.469 23475 23475 D LocBroadcastReceiver: New location update not possible within 5 seconds, not sending to HA
02-02 23:39:13.318 23475 23475 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-02 23:39:35.164 23475 23475 D LocBroadcastReceiver: Received location update.
...
02-02 23:39:35.188 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.569000 hAcc=6851.0 et=+1d1h55m21s496ms {Bundle[EMPTY_PARCEL]}]
02-02 23:39:35.188 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 3 of 5
02-02 23:39:42.593 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.569000 hAcc=6851.0 et=+1d1h55m28s918ms {Bundle[EMPTY_PARCEL]}]
02-02 23:39:42.593 23475 23475 W LocBroadcastReceiver: Location not accurate enough on retry 4 of 5
02-02 23:39:52.608 23475 23475 D LocBroadcastReceiver: Got single accurate location update: Location[fused xx.xxxxxx,yy.569000 hAcc=6851.0 et=+1d1h55m38s931ms {Bundle[EMPTY_PARCEL]}]
02-02 23:39:52.609 23475 23475 D LocBroadcastReceiver: No location was accurate enough, sending our last location anyway
02-02 23:40:53.635 23475 23475 D LocBroadcastReceiver: Received location update.
...

The Home Assistant GUI still shows my location to be either unknown or away.
I guess I’ll just keep the configuration as it is for now and see what tomorrow brings after having walked around the town a while. I wouldn’t rule out the possibility of our house just blocking all GPS satellite data (since that what it does on all other apps as well). I’ll get back to this.

I do not see it jumping at all. According to the logs I see some invalid events come through that get discarded as we would expect. I see only 1 location update actually being sent, the others never got updated.

What you should be paying attention to are which reports that are being skipped which are valid reports so you can adjust accuracy for that. Personally speaking when I am at home my location accuracy is high as 500 so I have adjusted it based on the output. It used to be at 400 but recently I needed to up it. The reason why we print all this data to the logs is so users can look at the decision making process for a location update and make adjustments based on their own needs.

After all, I got location services working by

  1. removing my fake Google account from microG
  2. disabling all location modules in microG (which were Mozilla Location Service and, for the address resolving, Nominatim)
  3. in my HA Companion app under Sensors > Background Location, turn on GPS for a couple of seconds
  4. restarting my phone.

I have no idea what exactly caused the issue, but one or more of the above things must have solved it.

It worked for more than a week now - however, the location services stopped working yesterday in the late afternoon for no obvious reason.
I started adb debug and see the following output:

02-28 11:31:16.771  9514  9806 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:31:16.771  9514  9806 D LocBroadcastReceiver: Removing background location requests.
02-28 11:31:16.776  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:31:16.790  9514  9806 D LocBroadcastReceiver: Registering for location updates.
02-28 11:31:20.237  9514  9599 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:31:20.237  9514  9599 D LocBroadcastReceiver: Removing background location requests.
02-28 11:31:20.247  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:31:20.248  9514  9599 D LocBroadcastReceiver: Registering for location updates.
02-28 11:31:24.421  9514  9599 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:31:24.421  9514  9599 D LocBroadcastReceiver: Removing background location requests.
02-28 11:31:24.427  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:31:24.438  9514  9599 D LocBroadcastReceiver: Registering for location updates.
02-28 11:31:25.491  9514  9806 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:31:25.491  9514  9806 D LocBroadcastReceiver: Removing background location requests.
02-28 11:31:25.503  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:31:25.511  9514  9806 D LocBroadcastReceiver: Registering for location updates.

Weirdly enough, turning on GPS now results in a permanent crash of the GPS location service (push notifications popping up and disappearing after <1 second):

02-28 11:38:59.162  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:38:59.369  9514  9806 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:38:59.378  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:38:59.504  9514  9806 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:38:59.514  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:38:59.922  9514  9806 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:38:59.931  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:00.018  9514  9599 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:00.026  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:00.160  9514 11863 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:00.168  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:00.263  9514  9599 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:00.279  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:00.741  9514  9596 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:00.754  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:01.006  9514  9603 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:01.032  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:01.069  9514  9605 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:01.092  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:01.324  9514 11866 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:01.360  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:01.652  9514  9603 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:01.683  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:02.055  9514 11866 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:02.096  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:02.133  9514 11879 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:02.171  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent

When deactivating the GPS mode, location services appear to go completely crazy:

02-28 11:39:32.729  9514 11937 D LocBroadcastReceiver: High accuracy mode appears to have stopped, restarting high accuracy mode
02-28 11:39:32.730  9514  9808 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.740  9514 11881 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.758  9514 11956 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.773  9514 11952 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.789  9514 11957 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.800  9514  9808 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:39:32.800  9514  9808 D LocBroadcastReceiver: Removing background location requests.
02-28 11:39:32.811  9514 11881 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.820  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:32.833  9514 11888 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.842  9514 11956 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.857  9514 11958 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.867  9514 11952 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.876  9514 11953 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:32.888  9514 11957 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.927  9514 11958 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:32.928  9514 11881 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:39:32.928  9514 11881 D LocBroadcastReceiver: Removing background location requests.
02-28 11:39:32.954  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:32.998  9514 11953 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:33.071  9514 11937 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:33.073  9514  9808 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:33.105  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:33.164  9514 11937 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:39:33.164  9514 11937 D LocBroadcastReceiver: Removing background location requests.
02-28 11:39:33.165  9514  9808 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:33.176  9514  9514 D LocBroadcastReceiver: Not requesting accurate location, last accurate location was too recent
02-28 11:39:33.214  9514 11881 D LocBroadcastReceiver: Registering for location updates.
02-28 11:39:33.244  9514 11888 D LocBroadcastReceiver: High accuracy mode parameters changed. Disable high accuracy mode.
02-28 11:39:33.289  9514  9808 D LocBroadcastReceiver: Background location updates appear to have stopped, restarting location updates
02-28 11:39:33.289  9514  9808 D LocBroadcastReceiver: Removing background location requests.
02-28 11:39:33.352  9514 11888 D LocBroadcastReceiver: Registering for location updates.

(and so on). After a couple of seconds, everything seems to be fine again, however the location still isn’t updated.

For me it somehow looks like the Android application shows an unknown behavior. Any idea about that?

EDIT:

Looking at the normal logcat, I can see following warning:

02-28 11:42:42.971 6129 8270 W ServiceManager: Permission failure: android.permission.HIGH_SAMPLING_RATE_SENSORS from uid=10157 pid=9514
which might be related to this?

Here the same, my apple devices are running so good as always, but the ones on Android devices aren’t updating!

did you try these troubleshooting steps already (linked earlier in the thread)? https://companion.home-assistant.io/docs/troubleshooting/faqs/#device-tracker-is-not-updating-in-android-app