GPS location update when in background

I have noticed that when the app is in background, it does not update GPS location at all. I have turned off power saving for the app completely but still it seems that the location is not updated until I bring the app to foreground. That’s really annoying, since I have a template to allow me to open the gate only when I am close to home (to prevent accidentally opening it when I’m away) and the location update even takes about 10-20 seconds after I start the app, so if I start the app when I’m at the gate, I have to wait until it updates to be able to open the gate. I have put up the proximity sensor output to one of the views to watch it and when I have arrived, it was still showing 5km (which was exactly the location where I started the HA app last time) and I had to wait like 15 seconds until it updated, it has dropped from 5 to 0.
Is this how it is supposed to work? If not, how can I fix it?
My phone is Xiaomi Pocophone F1 with the latest stock ROM (Android 10).

Thanks.

Have you checked it GPS permission? Android 10 now allows setting that the application has GPS access a) all the time, b) only when open, c) never.

Good point, but I have double-checked and the location permission is set to “Allow all the time”

Check all of these points as well: https://companion.home-assistant.io/docs/troubleshooting/faqs#location-is-not-updating-in-android-app

Thanks, I just did, so it has to be something else :frowning:

Battery preserving options?
I have a Huawei (older model) and it has some battery preserving feature that is on by default.
Before I disabled that I had the same problem

I have turned it off at the beginning… But now I have joined the beta program, so the app was updated to beta and today I’ve noticed that the problem went away, either it’s somehow fixed in beta version, or it only works sometimes, or sometimes it’s really slow with the GPS update. I will observe it further and I’ll post my findings here.

Well it looks like the problem is back, or maybe better to say it was always there even when I thought it was fixed.
I have noticed that the location only updates when I either have home assistant app running in foreground, or when other application is using GPS, otherwise it doesn’t force GPS to be on and thus it doesn’t update the location. When I am in the car and have the phone connected to Android Auto, there’s no problem. But when I don’t connect the cable, the location doesn’t update.

Same problem here.
Have disabled all power management on the app and allowed gps in background.

Also noticed that background use since last full charge is less than 5 minutes after a full day.

Dontkillmyapp.com should have some tips too consider