Sub Service_Start (StartingIntent As Intent)
Try
InitGPS
'StartServiceAt(Me, DateTime.Now + (60 * 1000 * Minutos) ,False)
ToastMessageShow("GPStoy Service GO",False)
Catch
ToastMessageShow("GPStoy Service Start " & LastException.Message ,True)
Log(LastException)
End Try
'nov 2018
'Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
End Sub
Sub InitGPS
Try
If GPS1.GPSEnabled = False Then
ToastMessageShow("Active la localizacion GPS", False)
StartActivity(GPS1.LocationSettingsIntent) 'Will open the relevant settings screen.
Else
Log("GPS Iniciado")
'el servicio solo se inicia 1 vez... el resto lo hace el gps1
GPS1.Stop
If modVarios.V_Config.ServicioActivo = "S" Then
modVarios.V_Config.HoraActiva = True
GPS1.Start( modVarios.V_Config.Intervalo * 1000 , 0) 'Listen to GPS with no filters.
Else
modVarios.V_Config.HoraActiva = False
GPS1 = Null
StopService(Me)
ToastMessageShow("GPStoy Servicio OFF en servicio", False)
End If
End If
Catch
'Msgbox (LastException.Message,"ERROR EN INITGPS")
Log(LastException)
End Try
End Sub