Android app location tracking

yes, what I see there is device_tracker.samsung, device_tracker.gil_galaxy_s23
and the state is set to home.
I put my phone in airplane mode for 15 minutes and it still shows as home.

the device tracker updates come from the app directly, if you turn on airplane mode then the app cannot send an update. Its also based on GPS so youd need to mock your location if you dont plan on leaving

correct. I didn’t think about that. looking at the history of the entity, it shows home during the entire 2 days where I clearly was out and about.

double check the below steps again, then get the logs if you didnt change anything please. Logs are shown as part of the same steps in the link. You may need to keep the app open for a bit as we need to see about 10 minutes of the logs to see if any updates come in. They should come in every few minutes if there are no errors. Logs will contain GPS and URL so be mindful if sharing. They may also give a clue to the reason for no updates, such as accuracy.

https://companion.home-assistant.io/docs/troubleshooting/faqs/#device-tracker-is-not-updating-in-android-app

also if not mentioned already, your HA instance needs to be remotely accessible for device tracking to work.

also if not mentioned already, your HA instance needs to be remotely accessible for device tracking to work.
This was accomplished using DuckDNS and an NGNIX reverse proxy addon. I have HTTPS access remotely and HTTP access locally.

I have these enabled:

  1. Under Configuration > Companion App > Manage Sensors ensure that the following Location Sensors are enabled: Background Location, Location Zone and Single Accurate Location

The device trackers I see under developer tools > states are: device_trackers: device_tracker.samsung, device_tracker.gil_galaxy_s23, device_tracker.galaxy_watch5_29pp

There’s no GPS tracking for some reason, and that is what I was expecting.
I’ll give it the reset of the day and then produce the logs. thank you for your help.

1 Like

I have the logs from the companion app to share, but I’m afraid due to any sensitive info.

All I can say is that I see the following:

--------- beginning of main
08-19 22:26:32.752 13386 13386 D SensorReceiver: Received intent: android.intent.action.TIME_TICK
08-19 22:26:32.764 13386 13450 I SensorReceiver: Skipping faster update because not charging/different preference
08-19 22:26:48.666 13386 13386 D SurfaceView@e82f1fe: updateSurface: has no frame
08-19 22:28:46.422 13386 13386 D LocBroadcastReceiver: Received location update.
08-19 22:28:46.440 13386 13386 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
08-19 22:28:46.440 13386 13450 D LocBroadcastReceiver: Last Location: 
08-19 22:28:46.440 13386 13450 D LocBroadcastReceiver: Coords:(##.#######, ##.#######)
08-19 22:28:46.440 13386 13450 D LocBroadcastReceiver: Accuracy: 20.0
08-19 22:28:46.440 13386 13450 D LocBroadcastReceiver: Bearing: 0.0
08-19 22:28:46.444 13386 13450 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
08-19 22:28:46.444 13386 13450 D LocBroadcastReceiver: Received location that is 2815 milliseconds old, 1692473323629 compared to 1692473326444 with source fused
08-19 22:28:46.447 13386 13450 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-19 22:28:46.793 13386  4296 D TrafficStats: tagSocket(109) with statsTag=0xffffffff, statsUid=-1
08-19 22:28:47.255 13386 13450 D LocBroadcastReceiver: Location update sent successfully for 1 as zone_only
08-19 22:28:47.264 13386 13386 D SensorReceiver: Received intent: io.homeassistant.companion.android.UPDATE_SENSOR
08-19 22:28:52.371 13386 13386 D SensorReceiver: Received intent: android.intent.action.TIME_TICK
08-19 22:28:52.379 13386 13450 I SensorReceiver: Skipping faster update because not charging/different preference
08-19 22:29:42.417 13386 13386 D SurfaceView@e82f1fe: updateSurface: has no frame
08-19 22:31:43.569 13386 13450 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-19 22:31:43.570 13386 13432 I WM-WorkerWrapper: Worker result SUCCESS for Work [ id=********************************* tags={ io.homeassistant.companion.android.websocket.WebsocketManager } ]
08-19 22:33:28.101 13386 13386 D SurfaceView@e82f1fe: updateSurface: has no frame
08-19 22:33:48.442 13386 13386 D LocBroadcastReceiver: Received location update.
08-19 22:33:48.453 13386 13386 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
08-19 22:33:48.453 13386 13450 D LocBroadcastReceiver: Last Location: 
08-19 22:33:48.453 13386 13450 D LocBroadcastReceiver: Coords:(##.#######, ##.#######)
08-19 22:33:48.453 13386 13450 D LocBroadcastReceiver: Accuracy: 20.0
08-19 22:33:48.453 13386 13450 D LocBroadcastReceiver: Bearing: 0.0
08-19 22:33:48.457 13386 13450 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
08-19 22:33:48.457 13386 13450 D LocBroadcastReceiver: Received location that is 3206 milliseconds old, 1692473625251 compared to 1692473628457 with source fused
08-19 22:33:48.457 13386 13450 D LocBroadcastReceiver: Duplicate location received, not sending to HA

I redacted the coordinates and some ID I saw there.

I believe the GPS is not used, nor the wifi to determine if home or not.

GPS is indeed used as you can see by the logs above, your own setting for the sensor dictates that it should not send GPS and only the zone.

https://companion.home-assistant.io/docs/core/location#manage-location-tracking-level

So you are not using default settings which means you are facing the following issue

I don’t get it.
I followed the guide from the previous link and made sure these are enabled:
Under Configuration > Companion App > Manage Sensors ensure that the following Location Sensors are enabled: Background Location, Location Zone and Single Accurate Location

I didn’t set anything other than what the doc stated. I cleared the data and started fresh.

check the sensor settings as the docs describe to change the setting back to default

  1. Location permission - Allow all the time + Use precise location ENABLED

  2. Ensure that location (GPS) is enabled on your device. - ENABLED

  3. Turn off battery optimizations for the app. UNRESTRICTED

  4. Background Location - ENABLED (for some reason it got disabled despite setting it to enabled)

  5. Location Zone - ENABLED (for some reason it got disabled despite setting it to enabled)

  6. Single Accurate Location - ENABLED. There’s a switch called include in sensor update I left it at
    default OFF since no where states to enable it.

if location is turned off on the device the sensors will become disabled the next time they check location

either way thats not what the last link I posted said.

Android Enabling location tracking can be managed on a per-server basis, exact/zone name only applies to all servers. Go to Manage Sensors > Background Location and change the Location Sent setting.

location is always turned on for my device.

Android Enabling location tracking can be managed on a per-server basis, exact/zone name only applies to all servers. Go to Manage Sensors > Background Location and change the Location Sent setting.

change it to what? to exact or to zone?

set it to exact so it sends the GPS coordinates to HA

1 Like

Set to exact. Tested for 3 days and it still shows I’m home while I was not.
I’m not sure what else is missing.

at this point only the logs can tell you

does any of this makes sense?

08-23 20:59:05.941 25371 25462 D BluetoothLeScanner: could not find callback wrapper
08-23 20:59:05.942 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:05.945 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:05.945 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:05.947 25371 25462 D BluetoothLeScanner: Start Scan with callback
08-23 20:59:05.954 25371  7614 D BluetoothLeScanner: onScannerRegistered() - status=0 scannerId=2 mScannerId=0
08-23 20:59:06.512 25371 25371 D LocBroadcastReceiver: Received location update.
08-23 20:59:06.516 25371 25371 D ForegrndServiceLauncher: Check if service HighAccuracyLocationService is running. Service running = false
08-23 20:59:06.516 25371 16551 D LocBroadcastReceiver: Last Location: 
08-23 20:59:06.516 25371 16551 D LocBroadcastReceiver: Coords:(xx.xxxxxxx, xx.xxxxxxx)
08-23 20:59:06.516 25371 16551 D LocBroadcastReceiver: Accuracy: 100.0
08-23 20:59:06.516 25371 16551 D LocBroadcastReceiver: Bearing: 0.0
08-23 20:59:06.518 25371 16551 D LocBroadcastReceiver: Begin evaluating if location update should be skipped
08-23 20:59:06.518 25371 16551 D LocBroadcastReceiver: Received location that is 90 milliseconds old, 1692813546428 compared to 1692813546518 with source fused
08-23 20:59:06.520 25371 16551 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-23 20:59:06.646 25371 16551 D LocBroadcastReceiver: Location update sent successfully for 1 as exact
08-23 20:59:06.659 25371 25371 D SensorReceiver: Received intent: io.homeassistant.companion.android.UPDATE_SENSOR
08-23 20:59:07.381 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:07.381 25371 25462 D BluetoothLeScanner: Stop Scan with callback
08-23 20:59:12.122 25371 25371 D SensorReceiver: Received intent: android.intent.action.TIME_TICK
08-23 20:59:12.128 25371 16551 I SensorReceiver: Skipping faster update because not charging/different preference
08-23 20:59:12.261 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:12.261 25371 25462 D BluetoothLeScanner: could not find callback wrapper
08-23 20:59:13.366 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:13.366 25371 25462 D BluetoothLeScanner: could not find callback wrapper
08-23 20:59:13.393 25371 25371 D SensorReceiver: Received intent: io.homeassistant.companion.android.UPDATE_SENSORS
08-23 20:59:13.395 25371 16551 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-23 20:59:13.403 25371 16551 I BluetoothAdapter: STATE_ON
08-23 20:59:13.417 25371 16551 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-23 20:59:13.418 25371 16551 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-23 20:59:13.484 25371 16551 D ServerConnectionInfo: localUrl is: false, usesInternalSsid is: false, usesWifi is: true
08-23 20:59:13.565 25371 16551 I SensorReceiver: Sensor updates and sync completed
08-23 20:59:13.783 25371 25462 I BluetoothAdapter: STATE_ON
08-23 20:59:13.783 25371 25462 D BluetoothLeScanner: could not find callback wrapper

Maybe you must open new post with this problem.
Because this post is for ibeacon in os watches, and you problem is location in the app.
in a new post more people can help with this problem, i think

looks like it was able to update your location just fine

but in HA the person.gil shows home all the time.