Android location update suddenly slow

Hello

I have the Pixel 6 Pro since 2 months. I installed the companion app and configured the location sensors. Till last week, everything worked like a charm! I have an automation which kicks in, when i arrive in my home zone to turn my entrance lamp on.
Since last week, the location updates work not as they did before. Sometimes the automation kicks in 5 minutes after i got home. Overall i get much less updates on my location. I did not change any location based settings.

I have adaptive battery enabled but set the app permission for HA to unrestricted. It worked perfectly that way till last week.

Anyone any idea what the problem could be?

Hello dshokouhi

Thanks for your post. I have seen the troubleshooting steps and i already went through them. The only thing i am not sure about is the battery optimization thing with adaptive batters. I like to believe that this is not the problem, due to the fact that it worked for several weeks with adaptive battery on.

I also checked the logs. I did not see as many location requests as there were before while on my way home.

I am a bit stuck with this problem, mainly because it used to work perfectly and suddenly it started struggling.

Do you think the “fresh start” for the companion app might help?

If Google isn’t sending frequent updates then there may not be much we can do. You can try to start fresh but we can only send updates when Google sends it to us.

I guess the fact that zone_expanded is not recognized, is also due to the irregular updates HA receives from google?

My zone_expanded trigger range is 400 meters. I also set everything else to 400

HA_Zone

So my best chance is to get google sending more updates. Maybe allow Google to run unrestricted in the background?

I’ve faced the same issue recently after buying a new phone.

When the screen is on, location updates are coming frequently. But when the screen is off, location updates are starting to come less and less frequently over time.

The less frequently you use your phone the less frequently you get location updates.

It seems that it depends on Android version (latest versions have more aggressive battery optimizations) and phone manufacturer (some manufacturers have more aggressive battery optimizations in their firmware).

I guess there is nothing that can be done and you have to live with that.

Hello anyuta1166

Thanks for your reply. Well i don’t know about that. I mean it worked for 7 weeks perfectly, why would it suddenly stop?

Or do you think that the adaptive battery learned my HA App usage-pattern and decided to shut it down, despite it’s unrestricted battery permission?

Its not very acceptable for me to just live with that. That would mean half of my automations are useless.

Are there any alternatives for the whole location tracking thing with HA?

Thanks

Some users have reported odd location issues when having the Pikmin app installed as it triggers a Google services bug. Not sure if that applies here. I haven’t noticed any issues in my pixel 6 pro. Location updates as it always has.

Hello dshokouhi

Thanks for the input. I don’t have this specific app nor do i remember downloading any app in the last 2 weeks. Today i decided to open the HA app shortly before one of my zones. The result was like it was two about weeks ago:

image

After that i minimized the app, got home and looked at it again. I was just suddenly home, the extended zone range trigger did not work for my home. HA never gets to trigger the high accuracy for the extended zone. Is this due to the fact that there are too less location updates? My high accuracy trigger range is also at 400 meters.

I mean it’s possible that this is a layer 8 problem, the location used to work perfectly, maybe i accidentally altered some android 12 settings.

what do you mean by you minimized the app? you just swiped to the home screen? or something else

For the issue about extended zone range, please look at the App Configuration logs when the issue occurs so we can see what the issue is there. You’ll want to look at the logs as things happen in order to properly troubleshoot.

Yes exactly, swiped to the home screen.

As far as i know, i can only see the logs which are written when i have the app open right? Or is there a way to see the logs for a specific timerange, while the app was not in foreground? Cause when i run the app in foreground at the time where the issue should appear, the extended zone trigger will work, as we saw in my last printscreens.

Maybe you could clarify the log behaviour so i can get you something usable.

Thank you dshokouhi

if your seeing things working when the app is open then you need to look at more device settings as your device is still not allowing the app to run in the background.

The logs will show for however long our app has been running for. If you only see a short amount of time then the app was killed by the system and given a new pid which means a new set of logs.

If you want to look at the full history you’ll need to use an app like Logcat Reader and grant it the specific permissions it requires to look at everything

Hello dshokouhi

Thank you for your replies!

Okei so today i tested the location behaviour. As i started my commute to work, i opened the HA app and went to the logs view. Then i locked the phone and left it like that. Extended zone trigger did not work this time, even when the app was clearly opened a couple minutes before. The Logs look like this:


At my way back home, i did the same. Before i drove home, i opened the app and locked the device. This time something strange happened. The high accuracy mode kicked in, but stopped somewhere in the middle to my zone.

Here are the logs of my way back home:






And then for my home zone, things worked like they should:
image

I hope you can get something out of this, if i need to do it better, you can tell me and i will try to get better debugging infos :slight_smile:

You said you also got a pixel 6 pro, do you have adaptive battery activated or not?

Thank you very much for your help, i really appreciate it!

yes its enabled on my device and the app has background access, data access unrestricted and battery optimzation turned off

I see a few messages about “location accuracy” not being met, you should consider adjusting your accuracy settings to fit the reported accuracy in any of those log messages

Try setting the accuracy number to at least 500 to see if that helps with the skipped reports.

Thanks for your reply!

Okay i will try that and look if it makes any difference.

Is the hAcc=xxx.xxx value the accuracy which HA got? Cause i have seen one today at 1300, so maybe i have to go even higher than 500?

I also noticed that the HA app background activity is less than a minute, which seems a bit odd to me. This should be much more if the app isn’t killed by android am i right?

Thank you so much!

go by whichever report has the highest number and the location is still correct so you may need to check the GPS coordinates to see if that high report is still correct. The reason for this check is because sometimes we will see accuracy 80k and the user being reported in the U.S. so that wasn’t ideal :slight_smile:

no thats fine, mine on average is a minute unless I am using the app a lot. Depends on how much development I am doing for the day :stuck_out_tongue:

Thank you very much!

Perfect, i will try the new settings tomorrow and post the results :+1:

One last question for today: The setting “battery optimization turned off” is just the unrestricted setting under battery right?

Thanks again

yup unrestricted, they changed the wording in android 12 here

Hello dshokouhi

So today i tried with the new settings. For my commute to work, i quickly launched the HA app and swiped it away (to the homescreen) before i went to my car and everything worked fine. Extended zone triggered and i got nice, frequent updates around my shopping zone.

I then left the HA app for the rest of the day and did not touch it. On my way back home, the extended zone got triggered, but a bit late. You can see that in the screenshot. I went from north-east to south-west:
image

I noticed that everytime i check the logs, the oldest entry is about 1 to 2 minutes ago. But the PID seems to stay the same. Does that indicate that android 12 is actually kind of killing the app? Or maybe still restricting from running correctly in the background?

Thank you very much!

i havnet found a rhyme or reason to how the logs from the PID are pulled honestly, I just konw that at times I can find an hour or longer in the logs or not much at all depending if the app was killed or not. Like for example if you launch the app and you see the icon briefly then you know its starting over.

Because it triggered later I wonder if accuracy is still an issue, for your use case try and use Logcat Reader and get it setup so next time you notice it hopefuly youll get more detailed logs. My hunch tells me its probably an accuracy issue, how high did you set it to?