A Basic Geolocation Example

The Geolocation API lets you track a user’s location. The API is device agnostic; the underlying mechanism might be via GPS, wifi, or simply asking the user to enter their location manually. Since these lookups can take some time, the API is asynchronous, and you pass it a callback method whenever you request a location.

The Trip Meter example displays the user’s initial location, and it tracks the distance the user has travelled since the page was loaded.

You can open the example in Dart Editor and run it by clicking index.html.

Read the source.

See all samples.