Android - Geofence not working

Life360 wants way TOO much personal information..My 2 cents

That's step 2 in troubleshooting. We wouldn't ask users to provide their location coordinates in public.

1 Like

Good poiont. But some of the other info is not conviently available, from what I can see, or am I missing something?

The issue is that Hubitat does not report as inside geofence when I'm inside. I open app up, and I'm smack bang in the middle of geofence, and it thinks I'm outside. I have to manually change the size of the geofence, and hey presto, it reports me as home. It cant be any of the optimisation issues, since I manually open the app, and it still reports incorrectly. It's been this way for at least 6 months.

Nonetheless.

  • Mobile device: Samsung Galaxy S21 Ultra
  • Android Version: 12
  • Software version: SAOMC_SM-G998B_OXM_XSA_12_0017 XSA/XSA,XSA/XSA/XSA
  • Security patch level: Aug 1, 2022
  • Mobile app version: 1.6.8. - build 128

No 3rd party optimization apps: correct
Battery and CPU/memory optimization services are disabled for Hubitat app: correct.

1 Like

It sure can be, the app is looking at location. If the app didn't see the change in phone's location until you forced the location to refresh, then it wouldn't be able to report that you are inside. This is good feedback and something that we can set up to try to replicate to see how else can the app force the location update in order to more accurately report the location change.

For reference, the above example is actually my production phone. I run Life 360, MacroDroid and Hubitat app in parallel to monitor our app's performance, and so far Life 360 and Hubitat have been neck in neck, with Life 360 using a lot more resources, which means that they use more battery and more data to monitor phone's activity. It is something that we are currently exploring.

1 Like

If you can't get it to work Alexa can be an alternative. All it takes is a virtual switch and a basic rule. Alexa detects you inside geofence turn switch off. When your outside turn it on. Or vice versa, whatever you like. I prefer on/open/away or any alert to be on. The real trick that I haven't figured out is how do you track kids without phones?

Anyways here's a pic of the rule

I've read in a few stack overflow posts that another app which is requesting location can help speed up geofence events for your app. Meaning that this might not be a great test - having an app like Life360 which is doing lots of location updates could end up helping Hubitat get a more timely enter/exit notification. The same would be true if you're using Google Maps in the car.


On a separate note, I've been playing with geofencing on my own app a bit this week and it really seems device dependent.. I've got an S20, S10 and Pixel 4a - all running Android 12 and all geofencing the same area with no battery optimizations.

I drove outside the geofenced area and only the Pixel got an EXIT notification. After a few minutes of nothing from the Samsung devices I ended up reboot them which finally produced the EXIT notification. Then, several hours later driving back into the geofence - again only the Pixel got the ENTER notification. The S10 got the ENTER event this morning and my S20 never got the ENTER event at all.

So, all that is to say - I think Samsung is really locking down geofence events. So, in order to be reliable in any way on these devices I think the app's unfortunately going to have to be a lot more like Life360 and request location updates from the background -- which sucks because Life360 is constantly showing notifications (needed to request location from the background..)

2 Likes

Excellent points and great feedback, as always. Thank you! This is something we have observed as well, and our engineers are looking into it.

1 Like

Anecdotally, I've noticed presence works much better if I'm navigating using Google Maps. I've noticed the same thing on my wife's phone. Both Galaxy S9. That's also why I re-enabled the location permission for Facebook, even though I hardly use it anymore and Facebook definitely doesn't need to know where I am. I figure the more chance there is for my phone to check my location for any reason, the better my reporting should be. I don't know if that's how it actually works, but I thought I'd give it a try.

I have weather and call blocker apps that have a persistent notifications (one for temperature display in the status bar, and one to monitor incoming calls in real time). They both get relegated to the small "Silent notifications" section at the bottom of my notifications, so they're really not that obtrusive. The call blocker doesn't show up in the status bar unless it actually blocks a call.

Thank you for posting this, Joe. I've followed these posts and wanted to respond so many times with, "So, what is Samsung doing?". The geofence has worked great for me for three years with two Pixel 3A's and now two Pixel 6A's.

1 Like

I have noticed this too. I'm the only one in my family that is using Samsung and I'm the only one that is having an issue. I'm getting 5–10-minute delay. There was an update to the firmware addressing security that has introduced delayed, I believe. I have my setup L360, Hubitat GF, and UNIFI WiFi. Then I use combination presence application to aggregate them all. It worked very well. However, since one of the Android/Samsung updates seemed to introduce this issue recently I have been doing testing.
I have started testing the following: Values in Minutes

  1. Hubitat - 3-5+ delay
  2. WebCore - 0-5
  3. Life360 - 2-7+ delay
  4. IFTTT - 0 delay

Note: Unifi depends on the polling you have setup (static mac) Part of all the test but not measured.

I believe what is going on here (in my very limited testing) is that IFTTT is running different not as a process/service the background but more as application within the notification part on android. IFTTT does recommend doing this for android devices.

The configuration that I have right now. L360, WebCore, IFTTT and Unifi WiFi.
This seems to be working well thus far.
I plan on doing more testing, but I think this always to be chasing issues between app dev, Mobile manufactures, and OS developers.

Well, the problem is back. I had a problem with the geofence not recognizing my phone's presence. After the last update of the app on my Android phone, it worked flawlessly for a few months. Now it is back again. I have tried the following:

  • Force stopping the app and clearing cache and storage
  • Send geo event
  • Powered off/on my phone
  • Uninstalled and reinstalled the app

Nothing seems to help. I am in the middle of my geofence right now but it shows out of geofence. Any other suggestions?

Thanks

A post was split to a new topic: Geofence is not working

Not working for me either. Now this may be obvious but perhaps helpful for debugging. If you change the size of the blue circle, even the minutest amount a Geo event will be sent and will be correct.

I now use a button I press on the way out the door. After pressed it waits 5 minutes after the garage door closes and then activates Away. When I return I press the button again to cancel Away. When the Geo fence is working correctly it activates before the button rule does. So my backup process has become my primary method of setting Away.

Just a reminder, every mobile device manufacturer has its own optimization tasks running on top of native Android tasks. It is imperative to share make, model and Android version when reporting issues with the Mobile app.

Our engineers are currently reviewing OneUI (4) for Samsung devices. We have not tested the following operating systems that use Android variations: OxygenOS (OnePlus), ColorOS (Oppo) or MIUI (Xiaomi). If you are using one of these operating systems, your experience may vary.

2 Likes

FWIW - I implemented presence/geofencing in my Android dashboard.

While it's still a work in progress - the results have been getting better and better. The intent wasn't to replace the native Hubitat app but more to supplement it.. there's no reason you can't run both. That said, for my testing I've disabled the Hubitat app's geofencing so I could make sure everything is working end-to-end and so far so good.

I tried to document how to get it configured here.

2 Likes

I have two SM-G998U devices. (S21 Ultra 5G) that were working almost flawlessly prior to the middle of July. Both are Android 12, OneUI 4.1, G998USQS5CVGA baseband version (August 1, 2022).

On Both phones:
Settings -> Device Care -> Battery -> Background Usage Limits -> Put unused apps to sleep is off.
In addition I added the below to Never Sleeping Apps (They have been since I got the phone)
-Hubitat
-Google play Services

Settings -> Device Care -> Battery -> More Battery Settings -> Adaptive Battery is off

In Settings -> Device Care -> Memory under Excluded apps, I have Hubitat and Google Play Services there as well.

In Settings -> Device Care -> 3 Dot Menu - > Automation, I have Auto Optimize Daily turned off (as well as all other options on this menu)

In Settings -> Apps -> Hubitat -> Battery, it is set to unrestricted. I also have no Permissions denied, Location at always, physical activity and camera while using app.

In Settings -> Apps -> Google Play Services -> Battery, it is set to unrestricted. Location all the time and also no permissions denied.

I went through each of these settings and toggled them off then back on trying to fix it. I also force stopped the app (hubitat), cleared cache, and restarted it.

For Geofence settings on both phones,
-Send presence only in motion is off.
-Validate location on network change is on
-Delay Exit is on: 2 minutes

I also have Tasker launching Hubitat in the background whenever the phone is restarted.

I don't think it is a Hubitat APP problem, as that has not updated on either phone since January 2022 (Currently 1.6.8). Location was working fine after that update until the middle of July sometime.

Since the middle of July, both phones were lagging on updating, and I noticed that often if we open the app, it would immediately update. Other times, I had to send a geo event, or using a custom rule with a switch, just force update Arrived or Departed.

Then, I got logged out of the Hubitat app (it happens at work sometimes due to VERY poor cell coverage). When I logged back in, and re-associated my phone with the proper device in the app, MINE has been rock solid for a week again. I tried doing the same to my wife's phone, force stop, clear cache, clear data, then sign in and re-associate. I then went and set all the battery saving/memory saving settings back to the above. Hers still doesn't work, mine still does. So :man_shrugging:

I have a Tasker profile that I use location to kick on my VPN when I leave the house and turn it off when I return. I added a step to force HE to update arrived and departed using Maker API. Works great on depart. (Was able to turn that off on my phone after the above log out/log in procedure) However, it is a bit slow. So, the second workaround is that I created a switch, that when turned on runs the rule to mark the phone presence as arrived. I then made a google home routine, and put it in as a custom command on android auto. So now, if she gets in the driveway, and the garage doesn't open, all she has to do is push the button on the Android auto screen and Voila.

It was tedious to set up. But, it is an okay workaround until we can figure out what Samsung did to us in the July update.

SM-G960U (Galaxy S9)

My wife's is the same. Both also not working since the middle of July. I also logged out, cleared data and logged in and mine has been working great, but that didn't work for my wife. I did notice that mine works/works better if I'm navigating home, but again that doesn't seem to matter on my wife's phone.

Been having the same issue as others. Here's my details:

  • Mobile device: Huawei P10
  • Android Version: 9
  • Security patch level: Aug. 1, 2019
  • Mobile app version: 1.6.8. - build 128
    Notes:
    No 3rd party optimization apps
    Battery and CPU/memory optimization services are disabled for Hubitat app.

Adjusting the geofence boundary has no effect. I don't even see the radius at all.

In the debug information it is indicating I'm out of the geofence, which I'm not. The lat and long are 0 but in the events it's showing the lat and long are correct (same as hub).

Hope this gets fixed.

On Pixel 6a running 1.6.7 build 132. Pic shows how actual location is not at what app shows as the center of the geo fenced circle. What's the word on this issue?

Download the Hubitat app