UserGuide

Web Device Location

From Xojo Documentation

Use Device Location to access the HTML5 GeoLocation capabilities provided by the browser (if supported).

Events

DeviceLocation

After calling the RequestDeviceLocation method, this method is called with the information about the location. If the location could not be determined, then the Error event is called instead.

Methods

RequestDeviceLocation

Asks the browser to request the device's location. Calls the DeviceLocation event if the location can be determined, otherwise calls the Error event.

Usage

The RequestDeviceLocation method asks the browser for the location:

DeviceLocation1.RequestDeviceLocation

The WebDeviceLocation object's DeviceLocation event is called with the location. This code displays the latitude and longitude:

Label1.Text = "Latitude=" + Str(latitude) + ", Longitude=" + Str(longitude)

See Also

WebDeviceLocation class; UserGuide:Web UI topic