Android Question Geofence detects entry to area but not exit???

tsteward

Well-Known Member
Licensed User
Longtime User
I have installed the example found HERE
The only thing I have changed to the GPS co-ordinates for Home and Work.
It adds the geofence and fires a notification if I enter then fenced area but does not notify me when leaving..

I am interested in this for another app but trying to understand it first.
Anyone have this issue or is it just me.
 

Sandman

Expert
Licensed User
Longtime User
Try with different devices and versions of OS to get a better grasp. Some devices are weird. Also, don't assume an event happens instantly, it can very well take 5-10 minutes, depending on your device.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I saw your earlier thread which introduced me to "geofences" and I took an interest. However, it seems to me that the primary benefit of geofencing is that it runs when your app has not been started. When I started playing with it to write a tracker I found that the well-known "Background location tracking" example (which contains a "start-at-boot" request) was quite good enough - it provides a location every few seconds and you can check that against your own list of "geofences". I am using square "checkpoint" areas and it looks fine - although I have not got to the field testing stage yet.

This is just a comment. If you cannot sort out the geofence exit problem try conventional GPS tracking. Mind you, I would be surprised if geofencing was not up to this task.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
. . . batteries empty out so fast..
Yes - I had wondered about that. Does that mean that geofencing tracks the devices location without using GPS satellite signals? I live in pretty open country - no chance around here of picking up accurate locations based on phone masts. Otherwise, what is the difference?
 
Upvote 0

Sandman

Expert
Licensed User
Longtime User
Does that mean that geofencing tracks the devices location without using GPS satellite signals?
Well, the device will use whatever means available. But GPS is the very last thing to try, because it's so very expensive. To my understanding it will use cell towers first of all (because that info is free), and if there are wifi base stations available it will use them too.

If you were out in the total wilderness where there is absolutely no cell phone reception due to lack of towers, and no civilization (so no wifi), your geofences would not trigger in the background. However, if you started Google Maps, that app would start the GPS, and the device would get a location fix, which in turn would trigger geofences. According to my understanding, anyway. I'll be glad to be proven wrong, I'd love to understand more of how geofences works.
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
Well, the device will use whatever means available.
I guess what we are talking about is the "fused location provider". However I don't understand how that could provide what appears to be reasonably precise positioning when here I have to rely on a single mast for my phone signal. So I feel that it must be using GPS. As someone said to me recently "I'll be glad to be proven wrong, I'd love to understand more of how geofences works."
 
Upvote 0

emexes

Expert
Licensed User
However I don't understand how that could provide what appears to be reasonably precise positioning when here I have to rely on a single mast for my phone signal.

My hope would be that the cell tower information is constantly known anyway as part of the phone's background GSM network operation, and that if that information is sufficient to determine whether you are definitely inside or outside of the geofenced area or not, then there is no need to fire up the GPS.

Eg, if you're connected to a cell tower in Sydney, then you're definitely not in a geofenced area in Melbourne. Or more generally, if you're connected to a cell tower more than a couple of cell zones away from the geofenced area rather than to cell towers closer to the geofenced area, then you're not in the geofenced area.

edit: just realised I'm basically restating this:
To my understanding it will use cell towers first of all (because that info is free)
 
Upvote 0

Brian Dean

Well-Known Member
Licensed User
Longtime User
I suppose that if in my first post I had written ". . . try fused location provider" instead of ". . . try conventional GPS tracking" it might have saved everyone a lot of time. My own situation just happens to be an literal "edge case".
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
All very interesting reading.
Battery life is definitely an issue. I'm experimenting at creating a job tracking app for a journeyman like a Locksmith, plumber etc.
They would have log in & log out button when they arrive on site or depart but humans just don't remember to do this hence the geofence idea.

Checking GPS location every 5-8 minutes or so would be more than sufficient and would save battery life no?
How would I compare this against a job site address an then go "Your on site but haven't logged in" etc
 
Upvote 0

emexes

Expert
Licensed User
How would I compare this against a job site address an then go "Your on site but haven't logged in" etc

Replies to this post:

https://www.b4x.com/android/forum/t...ival-at-a-particular-site.155177/#post-960935

will get you the "GPS coordinates" (latitude and longitude) of the job site address, and then with this post:

https://www.b4x.com/android/forum/t...between-2-gps-coordinates.115312/#post-720808

you can decide when you're within on-site-or-not-on-site distance.
 
Upvote 0

drgottjr

Expert
Licensed User
Longtime User
i'm amazed.
we have tradesmen who can remember to turn off the car's motor, to remove/put on
their glasses, to pull up their trousers, to open the car door to get out, to retrieve their
toolkit, but they can't remember or train themselves to tap the "i'm here" button to
log the location of and the start of a job. this is how we have google directing people
to drive off non-existent bridges.
 
Upvote 0

tsteward

Well-Known Member
Licensed User
Longtime User
i'm amazed.
we have tradesmen who can remember to turn off the car's motor, to remove/put on
their glasses, to pull up their trousers, to open the car door to get out, to retrieve their
toolkit, but they can't remember or train themselves to tap the "i'm here" button to
log the location of and the start of a job. this is how we have google directing people
to drive off non-existent bridges.
Lol we have had tradesman threatened with non payment and still they can't remember to even get paperwork filled out and signed.
I often wonder who puts their socks on in the morning ?
 
Upvote 0
Top