Android - Geofence not working

I have 2 Pixel 3 phones. I have discovered that it works but not well. Sometimes it is taking up to an hour to determine the change in the phones presence, either in or out of the geofence. And it was working so well for the last few months.

Did you post your information as requested above so engineers can try to track down the issue? There are hundreds of posts on this and other threads of this forum, and only one person has actually provided anything for engineering to go from.

:person_shrugging:

Mobile device: Samsung Galaxy S10 G5

Android Version: 12

Software version: G977UVRU8HVH1

Security patch level: July 1, 2022

Mobile app version: 1.6.9. - build 132 (note had issues with 1.6.8)

Notes:

No 3rd party optimization apps

Battery and CPU/memory optimization services are disabled for Hubitat app; Allow Data usage while Data Saver, is ON. Turned off Adaptive Battery and Turned-on Enhanced Processing (once all of this was, I believe this is responding better) However, crippling the power features of the phone. More testing is needed.

1 Like
  • Mobile device: Samsung Galaxy S9
  • Android Version: 10
  • Software build number: QP1A.190711.020.G960USQU9FVB2
  • Security patch level: March 1, 2022
  • Mobile app version: 1.6.9. - build 132
    Notes: No 3rd party optimization apps. Battery and CPU/memory optimization services are disabled for Hubitat app.

It's weird that many of us experienced the same problem in July after the beta had been working for months. Would checking out the code for an open source app like OwnTracks give any insight to how other apps handle location reporting in the background? It seems like the inside/outside radius part is the part that's not evaluating correctly. We know it says we're outside the radius when we're in and vice versa. When it does notice, it seems like it reports pretty quickly.

I hadn't heard that before but it does make sense.. this post certainly isn't proof but does hint that maybe Samsung did something a little overly aggressive with their optimization/battery logic in that patch.


I've done a lot of geofencing testing on Android of late and Samsung devices are definitely not notifying apps in a timely manner

FWIW I've read that running another app which gets location such as Google Maps, Life360, etc can help to trigger the OS in sending the geofence update to other apps that are interested. Meaning running one of these apps either in the foreground like Google Maps or in the background like Life360 can help you get your Hubitat geofence 'event' faster. I haven't verified that though.. in at least a few tests of mine I was navigating using Google Maps and still didn't get my Hubitat device 'departed' event

Here are the specs for my phone:

  • Mobile device: Google Pixel 3
  • Android Version: 12
  • Android security update: October 5, 2021
  • Baseband version: g845-00194-210812-B-7635520
  • Kernel Version: 4.9.g862f51bac900-ab7613625
    #0 Thu Aug 5 07:04:42 UTC 2021
  • Build number: SP1A.210812.016.C1
  • Google Play system update:: July 1, 2022
  • Mobile app version: 1.6.8
    Notes:
    No 3rd party optimization apps
    Battery and CPU/memory optimization services are disabled for Hubitat app.

I had an issue pre-July update. I have just received the July update today (freaken Verizon). However, there is a "patch" and not a full update that was pushed out prior to July.

I also had problems on my Samsung device since the July update. But yesterday I received a Samsung update.
Maybe it's a coincidence, but since then geofence has been working. Even several times without any problems.
Hopefully it stays that way. :crossed_fingers:

@GeertV What device do you have and the networking you are on. I'm a Samsung S10 g5 on Verizon. I just received the July update. I haven't received any post update yet.

To the group.
Are Pixel phones better with this? Or are they mainly are Samsung phones?

My device: Samsung A52s 5G. Android 12. The network I'm on is Telenet (Belgium provider). The update I received yesterday came with the security patch 1 September

You might check for updates. They released an update on 9/2 that inlcudes the August Android Security patch.

Thanks. I just received the July on 9/2 and the phone checks every night.

Just another update. I found something that seems to confirm my suspicion that it is related to the HE app being put to sleep. I was digging through all of the settings on my phone (S21 Ultra), my work phone (S10+) and my wife's phone (S21+). My S21 phone was working well. But, my wife's S21 was not. Confirmed all of the Battery Saver, Optimization and sleep settings were identical between the two. And just decided to google methods to use Tasker to detect if an app went to sleep, then reload it. That fell flat unless I want to root my phone. But, I then started searching for ways to keep an app open and I found an article on Android Central that uses the recent apps menu. Tested it for several days now, and it has my wife's phone working flawlessly again.

This is definitely worth a try if you have a Samsung and if you suspect the issues are related to the app being closed in the background. I was able to do the same on the S10 and the S21's. The article was actually written for the S20. I do not know if other android devices have the same options in the recents menu, but it is worth a try there too.

The only other issue I have ever had with geolocation was with the compass calibration getting out of whack because of the use of magnetic cases and mounts. I resolved that with an app (GPS Status and Info) and quit using magnetic devices to mount my phone. This was also an issue with geolocation on other apps (Smartthings, Arlo, and Ecobee) and was something I solved before I ever got to Hubitat.

Here is the article

How to keep an app permanently running in the background on the Galaxy S20 | Android Central

They did a poor job of describing exactly which icon to long press, so I worked up my own steps.

My steps

First, open the app (Hubitat) and then minimize it or hit the home button.

Second, open the recents screen by hitting the square navigation key or with a swipe up and hold gesture from the bottom of the screen.

Third, press and hold the hubitat app icon at the top of the app in the switcher (Circled below)

Fourth, On the pop up menu, select "Keep Open" (Highlighted below)

Once done, you will see the lock (circled bottom right).

Now, even if you click close all, the app will not swipe away. This does appear to survive reboots. But, I did have to do it again when I wiped the cache after an update. I haven't tried, but I am pretty you will also have to redo the process if you force close/clear cache on the app itself.

4 Likes

Glad it worked for you but unfortunately, I don't believe that's an across the board fix. I found that 'feature' too and I tried it on my S21 and it didn't do the trick. I did this with Owntracks and Hubitat (of course not at the same time because you can't have 2 apps configured that way) but neither were any more reliable.

Wow!.... I am looking though my post to see where I said anything other than "It is worth a try"
:man_shrugging:

Thanks for effort but it doesn't work on my s22 Ultra. The keep open option is not available in the menu for your 4th step. Assuming Samsung's attempt to get longer battery life by making some these options obsolete in newer models. Thanks again

It works on my S22 Ultra to keep the app open.

1 Like

I'm at&t. I don't have menu option to do it.

Are you sure it's not there? The firmware should be the same regardless of the provider.

It's there on my wife's s21 phone too.

1 Like

They seem to gave changed the wording to lock app,