LocationChanged Location Sensor starts only after minutes within building

I have an app that pops up all kind of puzzles if you reach a specific location.
When the app starts, i turn on the location sensor (see screenshot) and i put also a timer that checks every 30s if the location sensor is still enabled (i don't know if this is required but during tests i had the feeling that it was better with this)


Core module is the LocationSensor1.Locationchanged that checks if the tablet is within a specific rectangle of coordinates and if this is the case, than it starts some puzzles.

The problem that i face is that it starts very unregular and i am not identifying any logic in its start up behavior.
When i start the tablet (inside a building but within the "GPS coordinates rectangular) the game doesn't pop up his first puzzle immediately. Sometimes it takes more than 15 minutes before it starts popping up the first puzzle, other times it's only 2-3 minutes. It doesn't matter if i walk around, put the tablet against the window, go outside.. it is very very very unregular BUT once it pops up the first puzzle, it works further without any problem and if i immedialty after a first succesful start, close the app and restart again.. than it starts directly...
so it seems that it takes very long before the app and the tablet start applying 'locationChanged' but once it does, i can restart the app without any problem and it goes directly untill the time that i restart the whole tablet.. than it's again waiting for minutes before the app starts popping up the first puzzles (because it recognizes the locationchanged...)
my explanation doesn't sound logic at all so there must be a logic explanation but i don't understand it...

for the location sensor to work fine, your device needs a good GPS signal and usually that signal is weak inside a building...

have you seen @SteveJG's tips here


1 Like

hmm.. in fact, i do the same via a clock that kicks off the enabling again and again. I indeed read before that within the building, the GPS is less ideal but what is strange to me is that after waiting to work for minutes.. once it starts and i close and reopen the app, it works directly again..although i'm still inside and didn't move the tablet.
So it seems that the app waits very long to kick off the locationChanged but once it has done that, the tablet keeps doing it even if i close directly the app and restart the app again. but when i shut down the tablet, than i'm back to square one. Is there no trick to enable the locationchanged more rapidly?

Welcome Leen.

Certainly not when you use the GPS indoors probably. Have you read Using the Location Sensor ? The tutorial explains how the LocationSensor and GPS works. It should address some of your concerns.

The LocationChanged fires when the gps receiver receives notification that new location data is available. It is usually triggered by the TimeInterval, if the TimeInterval set lower than 20000 ms the Changed event usually won't fire every 20 seconds indoors.

Factors to be considered:

  • are you indoors or outdoors (outdoors results in stronger signals from more gps satellites)?
  • if you are indoors, the Changed event can still trigger if the device is near a window or in a building without a steel framework or heavy walls that can prevent reception of satellite messages to the gps receiver; however if not the Changed event may never trigger.
  • read about Accuracy; your device actually does not know precisely where it is.
  • the number of satellites that are in view of your gps continually changes, sometimes several are available to produce a satellite fix, sometime not enough to trigger a Changed event.

The trick might be to be near a window. You can try setting the TimeInterval to values more frequent than about 20 seconds and that might trigger the Changed event more often but ONLY if the gps can hear the satellite. Keep in mind (as described in the tutorial) the initial Changed event usually takes on the order of 20 to 30 seconds while the Android is determining where it is located. The Android doesn't know where it is until it receives a satellite fix and this might not be possible in some buildings.

Another trick might be a device with a more sensitive gps receiver.