#Event: NewLocation(lat as double, lng as double)
Sub Class_Globals
Private BANano As BANano 'ignore
Private mEventName As String
Private MyTimer as Timer
End Sub
'Initializes the object, setting the event
Public Sub Initialize(eventName As String)
mEventName = eventName
End Sub
Public Sub Start()
MyTimer.Initialize("MyTimer", 2000)
MyTimer.Enabled = true
End Sub
public Sub MyTimer_Tick()
GetLocation
End Sub
Sub GetLocation()
Dim args As List
Dim trackSuccess As BANanoObject = banano.CallBack(Me, "locationFound", args)
Dim trackError As BANanoObject = banano.callback(Me, "locationError", args)
banano.GeoLocation.GetCurrentPosition(trackSuccess, trackError)
End Sub
Sub locationFound(position As BANanoGeoPosition) 'ignoredeadcode
Log("locationFound")
Dim lat As Double = position.Latitude
lat = banano.parseFloat(lat)
Dim lng As Double = position.Longitude
lng = banano.parseFloat(lng)
BANano.RaiseEventToABM(mEventName & "_NewLocation", Array("lat","lng"), Array(lat, lng), "")
End Sub
Sub locationError(error As Int) 'ignoredeadcode
Log("locationError: " & error)
End Sub