Greetings,
I have been working in Corona for four years (and loving it, BTW) and have never come across a problem I couldn’t solve one way or another… until now. I have searched high and low for a solution, without success, so this is now my last resort.
I am building (what should be) a very simple cross platform desktop app, for Mac and Windows platforms. It attempts to grab weather data for the current location and display a 7-day forecast. The Mac OS X version works perfectly, both in the Simulator and the standalone executable. Windows 10, however, is exhibiting a behavior that has me stumped.
I am using the following code to first test if location services are available:
if not system.hasEventSource( "location" ) then -- alert that location services are not available else -- set a flag to true so that location can be obtained and weather data downloaded later end
Running in the Simulator on Windows 10, the above code returns ‘true’, and the app grabs the weather data from an external service URL.
After building for Win32, and running the standalone .exe, the above code returns ‘false’ and the alert is displayed. Running the .exe using Corona Output Viewer has the same result - location services are not available. Running the main.lua file from the Corona Shell also has the same result. It is only in the Simulator that location services are available.
I have checked to ensure that location services and are on under my Windows Settings. Location is on, Location Service is on, General Location is on, Default Location is set, and Apps that can use precise location are all on. I have tried turning location services off and on again (insert IT Crowd joke here), I have checked the Windows Registry to ensure that all location services are active. I have tested location services by opening the Windows Maps application, and it detects my exact location perfectly. Everything seems to be fine on the system side.
As far as I can tell, the above code *should* work. It works fine on the Mac OS X desktop version, but not on Windows 10. It works in the Simulator, but not in the standalone .exe or using the Corona Shell or Output Viewer.
As an aside - All my experience with Corona up until now has been on Macs, building iOS and Android games. I used to build for Windows (3.1,95,98,XP) 20+ years ago, but this is my first foray into building desktop apps for Windows 10, so maybe I’m missing some vital setting, although I have done extensive research into all the possible location services settings and potential issues, but I cannot find any information about this specific issue with building a Win 10 desktop app with Corona.
One thing occurred to me is that perhaps this is an issue with the app not having actually been installed - the .exe is being run directly from the folder it was built into. Could Windows be blocking the location services request from the app simply because it hasn’t been ‘officially’ installed via an installer application? However, I would have expected Windows to alert me to this fact when I try to run it.
So that’s my problem. I’ve been coding for 35 years and it is extremely rare that I have to ask for help - I prefer to find solutions myself because it’s a better way to learn - but I’ve been trying to figure this one out for weeks now, and I’m finally at the end of my rope.
Any assistance would be most gratefully accepted!
Many thanks. Niilo.