Cambios en como se envian los cambios de ubicacion y como se mantiene el servicio activo

This commit is contained in:
2023-09-30 06:00:20 -06:00
parent c9e05a01df
commit 68bac1707c
6 changed files with 112 additions and 32 deletions

View File

@@ -47,7 +47,8 @@ Sub Service_Start (StartingIntent As Intent)
Timer1.Enabled = True
UUC.Initialize
Subs.getPhnId
Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'Starter - Service_Start', '${Subs.fechaKMT(DateTime.now)}')"$)
Subs.bitacora($"Starter - Service_Start"$)
' Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'Starter - Service_Start', '${Subs.fechaKMT(DateTime.now)}')"$)
StartService(Tracker)
StartReceiverAt(Tracker, DateTime.Now + 30 * DateTime.TicksPerMinute, True)
#if RELEASE
@@ -57,16 +58,19 @@ End Sub
Private Sub Timer1_Tick
CallSubDelayed(Tracker, "StartFLP")
Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'TimerTick - tiempo trans: ${((DateTime.now - lastLocUpdate)/1000)}', '${Subs.fechaKMT(DateTime.now)}')"$)
Subs.bitacora($"TimerTick - tiempo trans: ${((DateTime.now - lastLocUpdate)/1000)}"$)
' Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'TimerTick - tiempo trans: ${((DateTime.now - lastLocUpdate)/1000)}', '${Subs.fechaKMT(DateTime.now)}')"$)
If logger Then Log("Next run " & DateTime.Time(DateTime.Now + interval * 1000))
' Log($"|${Tracker.FLP.IsInitialized}|${Tracker.FLP.GetLastKnownLocation.IsInitialized}|"$)If DateTime.DateForm
'Si ya pasaron mas de 15 minutos (900 segs) desde la ultima actualización, entonces mandamos UUC.
If ((DateTime.now - lastLocUpdate)/1000) > (interval * 1.5) Then
If logger Then LogColor($"Mandamos "Ultima Ubicacion Conocida" porque no se ha enviado en ${(interval * 1.5)} segs."$, Colors.red)
Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'TimerTick, Tiempo mayor a 1.5, iniciamos StartFLP y guardamos UUC', '${Subs.fechaKMT(DateTime.now)}')"$)
Subs.bitacora("TimerTick, Tiempo mayor a 1.5, iniciamos StartFLP y guardamos UUC")
' Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'TimerTick, Tiempo mayor a 1.5, iniciamos StartFLP y guardamos UUC', '${Subs.fechaKMT(DateTime.now)}')"$)
CallSubDelayed2(Tracker, "dameUltimaUbicacionConocida", UUC)
End If
Subs.borraArribaDe10000Bitacora
End Sub
Sub Service_TaskRemoved
@@ -79,5 +83,13 @@ Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
End Sub
Sub Service_Destroy
Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'Starter - Service destroyed')"$)
Subs.bitacora($"Starter - Service destroyed"$)
' Subs.gps_hist.ExecNonQuery($"insert into BITACORA (RUTA, TEXTO, FECHA) values ('${devModel}', 'Starter - Service destroyed')"$)
End Sub
Sub restartTracker
Log("Llamamos RESTART-TRACKER")
StopService(Tracker)
Sleep(1000)
StartService(Tracker)
End Sub