#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim GPS1 As ESLocation2
Dim gpsc As GPS
Dim gpson As Boolean
Dim velocitax As Int
Dim velocitadbl As Double
End Sub
Sub Service_Create
gpsc.Initialize("GPSC")
GPS1.Initialize("")
End Sub
Sub Service_Start (StartingIntent As Intent)
End Sub
Sub Service_Destroy
End Sub
Sub GPSC_LocationChanged(Location1 As Location)
velocitadbl=Location1.speed*3.6
velocitadbl=velocitadbl*.514444
velocitax=velocitadbl
If velocitax> Mioangelo.velocita Then Mioangelo.velocita=velocitax ' archivia il nuovo massimo
End Sub
Public Sub startGPS
Log("GpsON")
If gpson=False Then
If gpsc.GPSEnabled = False Then
GPS1.requestNetworkLocation(0,0)
Else
GPS1.requestNetworkLocation(0,0)
GPS1.requestGPSLocation(0,0)
gpsc.Start(0,0)
End If
gpson=True
End If
End Sub
Sub stopGPS
Log("GpsStop")
If gpson=True Then
gpsc.Stop
GPS1.stopGPSListening
GPS1.stopNetworkListening
gpson=False
End If
CancelScheduledService("")
StopService("")
End Sub