WebDeviceLocation.DeviceLocation
From Xojo Documentation
Event
WebDeviceLocation.DeviceLocation(Latitude as Double, Longitude as Double, Accuracy as Double, Altitude as Double, AltitudeAccuracy as Double, Heading as Double, Speed as Double, TimeStamp as Date)
New in 2011r2
Supported for all project types and targets.
New in 2011r2
Supported for all project types and targets.
Fires in response to a RequestDeviceLocation() call.
Notes
The parameters are as follows:
- Latitude and longitude are the geographic coordinates in decimal degrees.
- Accuracy is the accuracy level of latitude and longitude, in meters. The value is a non-negative real number.
- Altitude is the height of the position, in meters above the [WGS84] ellipsoid.
- AltitudeAccuracy attribute is specified in meters. AltitudeAccuracy is a non-negative real number.
- Heading is the direction of travel of the device, in degrees, where 0° ≤ heading < 360°, counting clockwise relative to the true north.
- Speed is magnitude of the horizontal component of the device’s current velocity, in meters per second. The value of the speed attribute must be a non-negative real number.
- Timestamp is date/time stamp when the position was acquired and is converted to local time.
For Accuracy, Altitude, AltitudeAccuracy, Heading, and Speed, if no value is specified the value will be -1. This is the case, for example, if the device is a desktop computer.
Sample Code
This code in a Button's Action event requests location data:
DeviceLocation1.RequestDeviceLocation
The DeviceLocation instance in the WebPage gets the new latitude and longitude in its DeviceLocation event and uses it to recenter a map with this line of code:
MapViewer1.GoToLocation(New WebMapLocation(Latitude, Longitude))
Any errors in the request triggers the Error event of the DeviceLocation instance:
MsgBox("The device could not be located: " + ErrorMessage)