Back

CreateLocator

Locator creates a Locator object to find the user's current location using either the device's GPS or information from the cell network and wifi.

app.CreateLocator( type, options ) -> app object - Locator

Example - Example



function OnStart()
{
    loc = app.CreateLocator("GPS,Network");
    loc.SetOnChange(loc_OnChange);
    loc.Start();
    app.ShowPopup("Locating");
}

function loc_OnChange(pos)
{
    var msg = pos.latitude + ", " + pos.longitude;
    app.ShowPopup( msg );
}
    Copy     Copy All       Run      

The following methods are avaiable on the Locator object:

  Destroy()
  GetBearingTo( latitude, longitude ) -> unknown
  GetDistanceTo( latitude, longitude ) -> unknown
  GetType() -> string - "Locator"
  Release()
  SetRate( rate )
  Start()
  Stop()
  id -> string - "#id"

string - "GPS" or "Network" or "?"
unknown
destroys object
number
?
?
?
function( data )
called when some of the values changed
number - seconds
update interval
start locator
stop locator
object id