Windows 10 Desktop App - Location Services Not Available

We don’t currently support location services on Windows.

The bug here is that the Simulator is responding to system.hasEventSource( “location” ) with true when it shouldn’t (i.e. the Desktop app’s response is actually correct).  

system.hasEventSource( ) first considers does CoronaSDK support the event source on this platform at all and then it determines whether the current device (or computer) has this functionality.

It seems that when “the app grabs the weather data from an external service URL” it’s making its own arrangements to determine the location and that’s why it works when the Simulator returns the false positive.

Supporting location services on Windows is on our todo list but I have no information on when it might be available.

And Rob is correct to say “generally if it works in the simulator, it should work in the desktop build” and I’m going to be interested to discover why that isn’t the case here.

I’ve determined the source of the confusion.

The Corona Simulator on Windows will synthesize a fake location event for lat/long 37.448485,-122.158911 for testing purposes but Desktop apps, for obvious reasons, don’t do this.

I’ll make sure the documentation includes this information.

Hi Perry,

Thank you very much for taking the time to look into this and letting me know what’s happening.

At least I know it’s not me doing something stupid! :slight_smile:

I guess that my only option right now would be to include a field where the user can enter their zip code manually, and I’ll explain to my client that it would only need to be done once when the app is first run, and when this service is eventually provided I’ll change the code to automate it.

Thanks again - I know this is a somewhat unusual use-case scenario, but I very much appreciate you investigating it.

Cheers, Niilo

If it’s going to run on a laptop of Surface, it may be portable, so you may need to  allow them to change their location.

We did a weather app as a sample:  https://github.com/coronalabs-samples/CoronaWeather and one of the features is the location selection screen which uses a local SQLite location database and uses a native.newTextField to do a search of the DB and show it in a temporary widget.newTableView. You could adapt something like that in your app.

Check it out.

Rob

That’s awesome!

Thank you Rob - I didn’t know about the weather sample. That will help a lot.

Cheers, Niilo