Updating Location Sensor When no Address is Found

Hi all,

I'm new to AI2 and I've recently been playing around with the "Where's My Car?" App linked below.

When I tested the app on my device, I noticed that the label that should show the current device location would not update whenever it went from receiving a location to not receiving one, and the textbox would display my latest GPS location even though I did not have a connection.

Here is the block of code of that is responsible for updating the label

So I am pretty sure that the .LocationChanged event just does not take into account losing GPS connection. Is there any way to check if the location sensor is no longer detecting GPS?

The LocationChanged event does not trigger unless there is a new satellite fix. If the current latitude and longitude do not change despite setting a LocationSensor.TimeInterval and that interval passes; you are not getting a satellite update.

The CurrentAddress displays an address or a message No address available if no address matches the addresses in Google's database .

How the GPS/Location sensor works is discussed the tutorial [Using the Location Sensor] .
It appears you have not read that yet Bob
(location sensor tutorial)

You might try the small app at Buenas noches amigos (How to display current location using the LocationSensor/gps) - #2 by SteveJG

What is happening: there is no event that changes your CurrentAddressDataLabel.Text other than in the LocationChanged event handler. Whatever was 'last' determined for the Location1.CurrentAddress is what will display. The 'contents' of you CurrentAddressDataLabel will not change until the LocationChanged event triggers as you coded.

You might find this tutorial HOW TO: Parse a LocationSensor's Current Address by SteveJG useful too Bob to understand how the geolocation pieces work.


Thank you! That document was very helpful.

1 Like