gps (android)

Contains functions for working with GPS.

Constants

GPS_PROVIDER : string = gps

NETWORK_PROVIDER : string = network

Functions

isEnabled(provider) — checks if the given location service provider is enabled

lastKnownLocation(provider) — gets last known location with the given location provider, or zero if it is unable to get location

getProviders(enabledOnly = false) — returns an array of location providers

requestUpdates(provider, minTime, minDistance, callback) — subscribes to the location listener

use std, gps

provider = "gps" // or passive, network if exists
// requestUpdates(provider, 0, 25, def(loc) = echo("location changed: ", loc))
requestUpdates(provider, 10 * 1000, 25, {
  "onLocationChanged" : def(loc) = echo("location changed: ", loc)
  "onStatusChanged" : def(p, status) = echo("status changed: ", p, " is ", getStatus(status))
  "onProviderEnabled" : def(p) = echo("provider ", p, " is now enabled")
  "onProviderDisabled" : def(p) = echo("provider ", p, " is now disabled")
})