My Clock1 timer interval is set at 1000(default). The LocationSensor1 is enabled and has a timerinterval of 60000(default)
The coordinates don't generate sometimes and return as 0, 0
Is there something I am doing wrong?
This means you request the gps to update once every 60 seconds. I recommend you update at 30 or 20 second intervals (use the LocationSensor1.TimerInterval Block and set it to 30000 ms). If you follow Kevinkun's advice, your coordinates may generate as you expect. You also might not be waiting long enough for the Location sensor to determine where your device is at before you press your submit button.
0,0 is the default coordinates received when a satellite fix has not been determined..
Your Label1 might require the location in the form xxxx,xxxx (with a comma separating the latitude and longitude ) and not xxxx xxxx (separated by a space). The comma might be needed when you use the Label1 in the Web1.Url
Thank you Kevin and Steve Personally I am able to get coordinates at my home, but my friends who are helping with testing my app, their submission shows as 0, 0. Kevin, like you said one of my friend did go outdoor and his submission did record lat and long. But my other friend's submission still shows 0, 0. Steve, I did add a coma and space to lat long, but somehow it got deleted when trying location sensor. And, like you said interval might also be one reason other than outdoor because my other friend selects the fruit in a jiffy and submits it too fast before the location sensor is able to determine the address. Here is the updated block.
Is this correct way of setting interval at screen initialize? Also, my default timer interval at designer is still 60000 and there is no way disable it. Should I leave the 60000 interval as is in designer block and continue setting the LocationSensor1.TimerInterval Block at screen initialize to 30000? Thank you both of you for the recommendations.
Yes. Set the TimeInterval early in the Screen1.Initialize stack (see Kevinjun's post).
This can be handled in the Submit Button event handler.
If LocationSenor1.Latitude =not 0 and LocationSensor1.Longitude =not 0 then do the submittal else use a Notifier to tell the user to try again in a few seconds. This prevents someone jumping the gun before the device decides where it is at.
Hopefully app is working better. Other factors influence how quickly a device will get a satellite fix (Android version, cpu software, whether you are also connected to a Map component etc. but you now have the main issues covered )
Thank You Kevin and Steve I have set locationsensor interval to 30000 in screeninitialize. I have added the suggestion of If LocationSenor1.Latitude =not 0 and LocationSensor1.Longitude =not 0 then Submit enabled to true else call notifier to tell the user to try after few seconds. See here -
Kevin, I disabled submit button in designer and in LocationSensor.LocationChanged event, if latitude <> 0, then set Submit.enabled to true. See the blocks -