mirror of
https://github.com/cheveguerra/FLP_2.0.git
synced 2026-04-18 19:59:15 +00:00
28/9/23 - Modificaciones para que mande la ubicación si no hay cambios durante 15 minutos.
This commit is contained in:
14
Tracker.bas
14
Tracker.bas
@@ -39,7 +39,7 @@ Sub Process_Globals
|
||||
'Para FusedLocationProvider (2 lineas)
|
||||
Public FLP As FusedLocationProvider
|
||||
Private flpStarted As Boolean
|
||||
Dim minAccuracy As Int = 50
|
||||
Dim minAccuracy As Int = 30
|
||||
End Sub
|
||||
|
||||
Sub Service_Create
|
||||
@@ -58,7 +58,7 @@ Sub flp_ConnectionSuccess
|
||||
End Sub
|
||||
|
||||
Sub flp_ConnectionFailed(ConnectionResult1 As Int)
|
||||
if starter.logger then Log("Failed to connect to location provider")
|
||||
If Starter.logger Then Log("Failed to connect to location provider")
|
||||
End Sub
|
||||
|
||||
Sub Service_Start (StartingIntent As Intent)
|
||||
@@ -88,14 +88,15 @@ Public Sub StartFLP
|
||||
Loop
|
||||
' If flpStarted = False Then
|
||||
Log("RequestLocationUpdates")
|
||||
Starter.FLPStatus = "Searching" : LogColor("FLP Searching", Colors.blue)
|
||||
FLP.RequestLocationUpdates(CreateLocationRequest) 'Buscamos ubicacion
|
||||
Log("Buscamos ubicacion")
|
||||
flpStarted = True
|
||||
' End If
|
||||
End Sub
|
||||
|
||||
Private Sub CreateLocationRequest As LocationRequest
|
||||
' Log("CreateLocationRequest")
|
||||
Starter.FLPStatus = "Searching" : LogColor("FLP Searching", Colors.blue)
|
||||
Dim lr As LocationRequest
|
||||
lr.Initialize
|
||||
lr.SetInterval(30000) 'Intervalo deseado para actualizaciones de ubicacion en milisegundos
|
||||
@@ -111,7 +112,7 @@ Sub dameUltimaUbicacionConocida(lastLocation As Location)
|
||||
If Starter.logger Then Log("This accuracy: " & FLP.GetLastKnownLocation.Accuracy)
|
||||
If Starter.logger Then Log("This distance to previous: " & FLP.GetLastKnownLocation.DistanceTo(lastLocation))
|
||||
Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&Subs.formatoFecha(FLP.GetLastKnownLocation.Time)
|
||||
If FLP.GetLastKnownLocation.Accuracy < 30 And FLP.GetLastKnownLocation.DistanceTo(lastLocation) > 25 Then
|
||||
If FLP.GetLastKnownLocation.Accuracy < minAccuracy And FLP.GetLastKnownLocation.DistanceTo(lastLocation) > 25 Then
|
||||
Starter.UUC = FLP.GetLastKnownLocation
|
||||
Subs.mandaLocAServer(FLP.GetLastKnownLocation, Starter.devModel)
|
||||
If Starter.logger Then Log("Mandamos GetLastKnownLocation : "&DateTime.Time(FLP.GetLastKnownLocation.Time))
|
||||
@@ -133,7 +134,8 @@ Public Sub StopFLP
|
||||
End Sub
|
||||
|
||||
Sub flp_LocationChanged (Location1 As Location)
|
||||
If Not(Starter.Timer1.Enabled) Then Starter.Timer1.Enabled = True : Log("timer enabled")
|
||||
Starter.FLPStatus = "Location changed" : LogColor("Location changed", Colors.blue)
|
||||
If Not(Starter.Timer1.Enabled) Then Starter.Timer1.Enabled = True : Log("timer enabled")
|
||||
If Starter.logger Then LogColor("FLP_LocationChanged", Colors.Red)
|
||||
' ToastMessageShow("FLP_LocationChanged", False)
|
||||
Dim coords As String = Location1.Latitude&","&Location1.Longitude&","&Subs.formatoFecha(DateTime.Now)
|
||||
@@ -147,7 +149,7 @@ Sub flp_LocationChanged (Location1 As Location)
|
||||
If Location1.Accuracy < minAccuracy Then CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords)
|
||||
If Location1.Accuracy < minAccuracy Then Starter.UUC = Location1
|
||||
If Location1.Accuracy < minAccuracy Then Subs.mandaLocAServer(Location1, Starter.devModel)
|
||||
if starter.logger then Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&Starter.devModel&"|")
|
||||
If Starter.logger Then Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&Starter.devModel&"|")
|
||||
CallSubDelayed(Main, "ponCoords")
|
||||
End Sub
|
||||
|
||||
|
||||
Reference in New Issue
Block a user