From 5fc486d742121d000465265b10bdc89c8580ec13 Mon Sep 17 00:00:00 2001 From: Javier Date: Fri, 26 Sep 2025 13:36:24 -0600 Subject: [PATCH] se arregla la parte de geocerca --- B4A/C_Cliente.bas | 8 +- B4A/Guna Vistas V3.1.b4a | 2 +- B4A/Guna Vistas V3.1.b4a.meta | 4 +- B4A/Tracker.bas | 343 +++++++++++++++++++++++++++++++--- 4 files changed, 329 insertions(+), 28 deletions(-) diff --git a/B4A/C_Cliente.bas b/B4A/C_Cliente.bas index 367260c..893f674 100644 --- a/B4A/C_Cliente.bas +++ b/B4A/C_Cliente.bas @@ -1093,7 +1093,10 @@ Sub B4XPage_Appear Else If geo = "1" And distance > 100 Then gest.Visible = False Tels.Visible = False - b_Inicio_Fin_venta.Visible = False + If b_Inicio_Fin_venta.IsInitialized Then + + b_Inicio_Fin_venta.Visible = False + End If ' ToastMessageShow("aaa", False) End If gest.Typeface =Typeface.CreateNew(Typeface.FONTAWESOME, Typeface.STYLE_BOLD) @@ -1245,6 +1248,7 @@ Sub GPS_LocationChanged (Location1 As Location) B4XPages.MainPage.lon_gps = Tracker.FLP.GetLastKnownLocation.Longitude ' Log("Coords set to: " & B4XPages.MainPage.lat_gps & " and " & B4XPages.MainPage.lon_gps) End If + Log(m_lat &" " & m_lon) If m_lat.Length > 0 And B4XPages.MainPage.lat_gps <> "0" Then Dim l1, l2 As Location l1.Initialize2(B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps) @@ -1285,7 +1289,7 @@ Sub GPS_LocationChanged (Location1 As Location) End If End If If geo = "1" Then - If distance < 10000000000000000000000000000000 Then + If distance < 10000000000000000000000000000000000000000000000000000000000 Then LA_GEO.TextColor = Colors.Blue Tels.Visible = True gest.Visible = True diff --git a/B4A/Guna Vistas V3.1.b4a b/B4A/Guna Vistas V3.1.b4a index e6dbce3..9079f83 100644 --- a/B4A/Guna Vistas V3.1.b4a +++ b/B4A/Guna Vistas V3.1.b4a @@ -284,7 +284,7 @@ Version=12.8 #Region Project Attributes #ApplicationLabel: Guna Preventa #VersionCode: 1 - #VersionName: 5.08.09 + #VersionName: 5.09.15 'SupportedOrientations possible values: unspecified, landscape or portrait. #SupportedOrientations: portrait #CanInstallToExternalStorage: False diff --git a/B4A/Guna Vistas V3.1.b4a.meta b/B4A/Guna Vistas V3.1.b4a.meta index 0db2a8f..ad48e52 100644 --- a/B4A/Guna Vistas V3.1.b4a.meta +++ b/B4A/Guna Vistas V3.1.b4a.meta @@ -82,6 +82,6 @@ ModuleClosedNodes6= ModuleClosedNodes7=6,8,9,10,11 ModuleClosedNodes8= ModuleClosedNodes9= -NavigationStack=Diseñador Visual,cliente.bal,-100,2,Main,Activity_Resume,46,0,Main,Globals,22,0,Main,Activity_Create,28,0,Main,Activity_ActionBarHomeClick,37,0,C_Cliente,Class_Globals,0,0,C_Cliente,Impresion3,2685,0,C_Cliente,B_IMP_Click,2674,2,C_Cliente,B4XPage_Appear,1145,3,C_Cliente,TraeCantProd,1222,6 +NavigationStack=C_Cliente,B4XPage_CloseRequest,2446,0,C_Cliente,JobDone,1597,0,C_Cliente,Class_Globals,407,0,C_Cliente,Camera1_PictureTaken,6331,0,C_Cliente,B4XPage_Appear,1091,5,Tracker,CreateNotification,502,1,C_Cliente,GPS_LocationChanged,1248,6,Tracker,flp_LocationChanged,472,0,Tracker,Service_Destroy,513,0,Tracker,revisaUUG,579,0 SelectedBuild=0 -VisibleModules=25,2,14,26,5,10,11,20,19,16 +VisibleModules=25,2,14,26,5,10,11,20,19,16,27 diff --git a/B4A/Tracker.bas b/B4A/Tracker.bas index 31a58cb..53e85df 100644 --- a/B4A/Tracker.bas +++ b/B4A/Tracker.bas @@ -4,6 +4,310 @@ ModulesStructureVersion=1 Type=Service Version=10.2 @EndOfDesignText@ +'#Region Service Attributes +' #StartAtBoot: True +'#End Region +''****************************************************************************** +''No olvidar agregar esta linea al editor de manifiesto: +'' SetServiceAttribute(Tracker, android:foregroundServiceType, "location") +'' +''En Starter agregar estas lineas en Process_Globals +'' Public rp As RuntimePermissions +'' Public FLP As FusedLocationProvider +'' Private flpStarted As Boolean +'' +''En Main agregar estas lineas a Activity_Resume +'' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) +'' Wait For Activity_PermissionResult (Permission As String, Result As Boolean) +'' If Result Then +'' StartService(Tracker) +'' Log("Start Tracker") +'' Else +'' ToastMessageShow("No permission", True) +'' End If +'' +''Se necesitan las librerias FusedLocationProvider, GPS, Phone y RunTimePermissions +'' +''Y en Main agregar estas dos lineas: +''#AdditionalJar: com.android.support:support-v4 +''#AdditionalJar: com.google.android.gms:play-services-location +' +'Sub Process_Globals +' Private nid As Int = 51042 +' Private Tracking As Boolean +' Private lock As PhoneWakeState +' 'Para FusedLocationProvider (2 lineas) +' Public FLP As FusedLocationProvider +' Dim actualLR As LocationRequest +' Private flpStarted As Boolean +'' Dim locRequest As String +' Dim UUGCoords As Location 'Ultima Ubicacion Guardada +'End Sub +' +'Sub Service_Create +' Service.AutomaticForegroundMode = Service.AUTOMATIC_FOREGROUND_NEVER 'we are handling it ourselves +' 'Para FusedLocationProvider (2 lineas) +' FLP.Initialize("flp") +' FLP.Connect +' lock.PartialLock +' StartFLP +'End Sub +' +'Sub flp_ConnectionSuccess +'' Log("Connected to location provider") +' 'FLP.GetLastKnownLocation +'End Sub +' +'Sub flp_ConnectionFailed(ConnectionResult1 As Int) +' Log("Failed to connect to location provider") +'End Sub +' +'Sub Service_Start (StartingIntent As Intent) +' 'Para FusedLocationProvider (1 linea) +' Service.StopAutomaticForeground +' Service.StartForeground(nid, CreateNotification("...")) +' Track +' StartServiceAt(Me, DateTime.Now + 5 * DateTime.TicksPerMinute, True) +' FLP.GetLastKnownLocation.Initialize +'End Sub +' +'Public Sub Track +'' Log("Inicia Track - Tracking : "&Tracking) +' If Not(FLP.IsInitialized) Then FLP.Initialize("flp") +' If Not(FLP.IsConnected) Then FLP.Connect +' If Tracking And actualLR.IsInitialized Then +'' Log(actualLR.GetSmallestDisplacement) +' Return 'Si ya estamos "rastreando" no hacemos nada (return) +' End If +' If Starter.rp.Check(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) = False Then +' Log("No permission") +' Return +' End If +' StartFLP 'Iniciamos FusedLocationProvider +' Tracking = True +'End Sub +' +'Public Sub StartFLP +' Log("StartFLP - flpStarted="&flpStarted) +' Do While FLP.IsConnected = False +' Sleep(500) +'' Log("sleeping") +' Loop +'' If flpStarted = False Then +'' Log("RequestLocationUpdates") +' FLP.RequestLocationUpdates(CreateLocationRequest) 'Buscamos ubicacion +'' Log("Buscamos ubicacion") +'' Log(actualLR.GetSmallestDisplacement) +' flpStarted = True +'' End If +'End Sub +' +'Public Sub StartFLPSmall +'' Log("StartFLPSmall - flpStarted="&flpStarted) +' Do While FLP.IsConnected = False +' Sleep(500) +' Log("sleeping") +' Loop +' dameUltimaUbicacionConocida 'Regresamos ultima ubicacion conocida +' FLP.RequestLocationUpdates(CreateLocationRequestSmallD) 'Buscamos ubicacion 2 peticiones +'' Log("Buscamos ubicacion Small displacement") +'' Log("GPSSmallestDisplacement = " & actualLR.GetSmallestDisplacement) +'End Sub +' +'Private Sub CreateLocationRequest As LocationRequest +'' Log("CreateLocationRequest") +' Dim lr As LocationRequest +' lr.Initialize +' lr.SetInterval(10000) 'Intervalo deseado para actualizaciones de ubicacion +' lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion +' lr.SetSmallestDisplacement(40) 'Solo registra cambio de ubicacion si es mayor a XX mts +' lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY) +' actualLR=lr +' Return lr +'End Sub +' +'Private Sub CreateLocationRequestSmallD As LocationRequest +' Log("Iniciamos CreateLocationRequestSmallD") +' Dim lr As LocationRequest +' lr.Initialize +' lr.SetInterval(2000) 'Intervalo deseado para actualizaciones de ubicacion +' lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion +' lr.setNumUpdates(2) 'Solicitamos solo 2 actualizaciones con estos parametros +' lr.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts +' lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY) +' actualLR=lr +' Return lr +'End Sub +' +'Sub dameUltimaUbicacionConocida +' If FLP.GetLastKnownLocation.IsInitialized Then 'Mandamos ultima ubicacion guardada +'' If Main.logger Then Log("Mandamos UUC : "&formatoFecha(FLP.GetLastKnownLocation.Time)) +' If Starter.Logger Then LogColor($"Mandamos UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|Acc:$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|Spd:$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35)) +' Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&formatoFecha(FLP.GetLastKnownLocation.Time) +' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords) +'' Subs.mandamosLoc(coords) +' End If +'End Sub +' +'Public Sub StopFLP +' 'Log("StopFLP") +' If flpStarted Then +' FLP.RemoveLocationUpdates 'Eliminamos todas las solicitudes de ubicacion +' flpStarted = False +' End If +'End Sub +' +'Sub flp_LocationChanged (Location1 As Location) +'' ToastMessageShow("Loc changed", False) +' LogColor($"Loc changed:${Location1.Longitude},${Location1.Latitude}"$, Colors.Red) +' B4XPages.MainPage.lat_gps = Location1.Latitude +' B4XPages.MainPage.lon_gps = Location1.Longitude +' UUGCoords = Location1 +'' Starter.ubicacionActual = Location1 +'' Log("SmallestDisplacement="&actualLR.GetSmallestDisplacement) +'' If DateTime.Now > LastUpdateTime + 10 * DateTime.TicksPerSecond Then +'' Dim n As Notification = CreateNotification($"$2.5{Location1.Latitude} / $2.5{Location1.Longitude}"$) +'' n.Notify(nid) +'' LastUpdateTime = DateTime.Now +'' End If +' If B4XPages.MainPage.lat_gps = 0 Or B4XPages.MainPage.lat_gps = Null And FLP.GetLastKnownLocation.IsInitialized Then +' B4XPages.MainPage.lat_gps = FLP.GetLastKnownLocation.Latitude +' B4XPages.MainPage.lon_gps = FLP.GetLastKnownLocation.Longitude +' Starter.ubicacionActual = FLP.GetLastKnownLocation +' LogColor("Coords en CERO - Guardamos ultima ubicacion conocida", Colors.red) +' End If +' '/////// para la ultima localización FL +' Dim sDate,sTime As String +' DateTime.DateFormat = "MM/dd/yyyy" +' sDate=DateTime.Date(DateTime.Now) +' sTime=DateTime.Time(DateTime.Now) +' If Not(B4XPages.MainPage.skmt.IsInitialized) Then B4XPages.MainPage.skmt.Initialize(Starter.ruta,"kmt.db", True) +' Try +' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO HIST_GPS (HGDATE, HGLAT, HGLON) VALUES(?,?,?) ", Array As Object (sDate & sTime, B4XPages.MainPage.lat_gps, B4XPages.MainPage.lon_gps)) +' B4XPages.MainPage.skmt.ExecNonQuery("DELETE FROM HIST_GPS") +' Catch +' LogColor(LastException, Colors.Red) +' End Try +' '/////// +' Dim coords As String = Location1.Latitude&","&Location1.Longitude&","&formatoFecha(Location1.Time) +'' Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&B4XPages.MainPage.usuario&"|") +'' Log("Mandamos Ubicacion") +' Log(FirebaseMessaging.locRequest) +' ' Solo mandamos la ubicacion si la precision es menor a XX mts +' If Location1.Accuracy < 100 Then +'' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords) +' End If +' If B4XPages.MainPage.cliente.LA_GPS.IsInitialized Then +' B4XPages.MainPage.cliente.LA_GPS.Text = "CON UBICACION GPS" +' B4XPages.MainPage.cliente.LA_GPS.TextColor = Colors.Black +' End If +'' LogColor(Location1.Latitude, Colors.red) +' CallSub2(Starter, "GPS_LocationChanged", Location1) +'' CallSub2(gestion, "GPS_LocationChanged", Location1) +' CallSub2(B4XPages.GetPage("Cliente"), "GPS_LocationChanged", Location1) +'' CallSub2(nuevocliente, "GPS_LocationChanged", Location1) +'End Sub +' +'Sub CreateNotification (Body As String) As Notification +' Dim notification As Notification +' notification.Initialize2(notification.IMPORTANCE_LOW) +' notification.Icon = "icon" +' notification.SetInfo("GUNA", Body, Main) +' Return notification +'End Sub +' +'Sub Service_Destroy +' If Tracking Then +' StopFLP +' End If +' Tracking = False +' lock.ReleasePartialLock +'End Sub +' +'Sub formatoFecha(fecha As String) As String 'Convierte una fecha al formato yyMMddHHmmss +'' Log(fecha) +' Dim OrigFormat As String = DateTime.DateFormat 'save orig date format +' DateTime.DateFormat="yyMMddHHmmss" +' Dim lastUpdate As String=DateTime.Date(fecha) +' DateTime.DateFormat=OrigFormat 'return to orig date format +'' Log(lastUpdate) +' Return lastUpdate +'End Sub +' +''Revisamos que el FLP (FusedLocationProvider) este inicializado y activo +'Sub revisaFLP 'ignore +' LogColor("**** **** Revisamos FLP **** ****", Colors.RGB(78,0,227)) +' Private todoBienFLP As Boolean = True +' Try +' If Not(FLP.IsInitialized) Then +' Subs.log2DB("revisaFLP: No esta inicializado ... 'Reinicializando FLP'") +' FLP.Initialize("flp") +' todoBienFLP = False +' End If +' Catch +' LogColor("If Not(Tracker.FLP.IsInitialized) --> "&LastException, Colors.Red) +' End Try +' Try +' If FLP.IsInitialized Then +' Try +' If Not(FLP.IsConnected) Then +' Subs.log2DB("revisaFLP: No esta conectado ... 'Reconectando FLP'") +' ' Tracker.FLP.Connect +' StartFLP +' todoBienFLP = False +' End If +' Catch +' LogColor("If Not(Tracker.FLP.IsConnected) --> "&LastException, Colors.Red) +' End Try +' Try +' If FLP.IsConnected And _ +' FLP.GetLastKnownLocation.IsInitialized And _ +' FLP.GetLastKnownLocation.DistanceTo(UUGCoords) > 500 Then +' Subs.log2DB("revisaFLP: 'No se esta actualizando, lo reiniciamos ...'") +' StartService(Me) +' todoBienFLP = False +' End If +' Catch +' LogColor("If FLP.IsConnectctd and FLP.getLKL.IsInitialized --> "&LastException, Colors.Red) +' End Try +' End If +' If todoBienFLP Then LogColor(" +++ +++ Sin errores en FLP", Colors.Green) +' Catch +' LogColor("If Tracker.FLP.IsInitialized --> "&LastException, Colors.Red) +' End Try +' ' revisar hora de lastKnownlocation y si es mayor de 10 minutos llamar StartFLP +'End Sub +' +''Compara la UUG (Ultima Ubicacion Guardada) con FLP.LastKnowLocation y si +''cumple con los requisitos de distancia y precision la guardamos en la BD. +'Sub revisaUUG 'ignore +' Try +'' revisaFLP +' If FLP.IsInitialized And FLP.IsConnected Then +' Try +' If FLP.GetLastKnownLocation.IsInitialized Then +'' Dim x As Location = FLP.GetLastKnownLocation +' Dim daa As Int = UUGCoords.DistanceTo(FLP.GetLastKnownLocation) 'Distancia de la UUG a la actual de Tracker.FLP.GetLastKnownLocation +' If Starter.Logger Then LogColor($"**** UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35)) +' If daa > 40 And FLP.GetLastKnownLocation.Accuracy < 35 Then 'Si la distancia de la ubicacion anterior es mayor de XX y la precision es menor de XX, la guardamos ... +' B4XPages.MainPage.skmt.ExecNonQuery2("INSERT INTO RUTA_GPS(fecha, lat, lon) VALUES (?,?,?)", Array As Object (Subs.fechaKMT(FLP.GetLastKnownLocation.Time),FLP.GetLastKnownLocation.Latitude,FLP.GetLastKnownLocation.Longitude)) +' If Starter.Logger Then Log("++++ Distancia a anterior="&daa&"|"&"Precision="&FLP.GetLastKnownLocation.Accuracy) +' End If +' UUGCoords = FLP.GetLastKnownLocation +' End If +' Catch +' LogColor("FLP.GetLastKnownLocation.IsInitialized --> "&LastException, Colors.Red) +' End Try +' Else +' Log("StartFLP") +' StartFLP +' End If +' Catch +' LogColor("If FLP.IsInitialized --> "&LastException, Colors.Red) +' End Try +'End Sub + + #Region Service Attributes #StartAtBoot: True #End Region @@ -18,7 +322,7 @@ Version=10.2 ' 'En Main agregar estas lineas a Activity_Resume ' Starter.rp.CheckAndRequest(Starter.rp.PERMISSION_ACCESS_FINE_LOCATION) -' Wait For Activity_PermissionResult (Permission As String, Result As Boolean) +' Wait For B4XPage_PermissionResult (Permission As String, Result As Boolean) ' If Result Then ' StartService(Tracker) ' Log("Start Tracker") @@ -32,6 +336,7 @@ Version=10.2 '#AdditionalJar: com.android.support:support-v4 '#AdditionalJar: com.google.android.gms:play-services-location + Sub Process_Globals Private nid As Int = 51042 Private Tracking As Boolean @@ -88,7 +393,7 @@ Public Sub Track End Sub Public Sub StartFLP - Log("StartFLP - flpStarted="&flpStarted) +' Log("StartFLP - flpStarted="&flpStarted) Do While FLP.IsConnected = False Sleep(500) ' Log("sleeping") @@ -118,22 +423,22 @@ Private Sub CreateLocationRequest As LocationRequest ' Log("CreateLocationRequest") Dim lr As LocationRequest lr.Initialize - lr.SetInterval(10000) 'Intervalo deseado para actualizaciones de ubicacion + lr.SetInterval(1) 'Intervalo deseado para actualizaciones de ubicacion lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion - lr.SetSmallestDisplacement(40) 'Solo registra cambio de ubicacion si es mayor a XX mts + lr.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY) actualLR=lr Return lr End Sub Private Sub CreateLocationRequestSmallD As LocationRequest - Log("Iniciamos CreateLocationRequestSmallD") +' Log("Iniciamos CreateLocationRequestSmallD") Dim lr As LocationRequest lr.Initialize lr.SetInterval(2000) 'Intervalo deseado para actualizaciones de ubicacion lr.SetFastestInterval(lr.GetInterval / 2) 'Intervalo minimo para actualizaciones de ubicacion lr.setNumUpdates(2) 'Solicitamos solo 2 actualizaciones con estos parametros - lr.SetSmallestDisplacement(0) 'Solo registra cambio de ubicacion si es mayor a XX mts + lr.SetSmallestDisplacement(1) 'Solo registra cambio de ubicacion si es mayor a XX mts lr.SetPriority(lr.Priority.PRIORITY_HIGH_ACCURACY) actualLR=lr Return lr @@ -144,7 +449,7 @@ Sub dameUltimaUbicacionConocida ' If Main.logger Then Log("Mandamos UUC : "&formatoFecha(FLP.GetLastKnownLocation.Time)) If Starter.Logger Then LogColor($"Mandamos UUC "${Subs.fechaKMT(FLP.GetLastKnownLocation.Time)}|Acc:$0.2{FLP.GetLastKnownLocation.Accuracy}|$0.8{FLP.GetLastKnownLocation.Latitude}|$0.8{FLP.GetLastKnownLocation.Longitude}|Spd:$0.2{FLP.GetLastKnownLocation.Speed}|"$, Colors.RGB(255,112,35)) Dim coords As String = FLP.GetLastKnownLocation.Latitude&","&FLP.GetLastKnownLocation.Longitude&","&formatoFecha(FLP.GetLastKnownLocation.Time) - CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords) +' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords) ' Subs.mandamosLoc(coords) End If End Sub @@ -159,23 +464,16 @@ End Sub Sub flp_LocationChanged (Location1 As Location) ' ToastMessageShow("Loc changed", False) - LogColor($"Loc changed:${Location1.Longitude},${Location1.Latitude}"$, Colors.Red) +' Log($"Loc changed:${Location1.Longitude},${Location1.Latitude}"$) B4XPages.MainPage.lat_gps = Location1.Latitude B4XPages.MainPage.lon_gps = Location1.Longitude UUGCoords = Location1 -' Starter.ubicacionActual = Location1 ' Log("SmallestDisplacement="&actualLR.GetSmallestDisplacement) ' If DateTime.Now > LastUpdateTime + 10 * DateTime.TicksPerSecond Then ' Dim n As Notification = CreateNotification($"$2.5{Location1.Latitude} / $2.5{Location1.Longitude}"$) ' n.Notify(nid) ' LastUpdateTime = DateTime.Now ' End If - If B4XPages.MainPage.lat_gps = 0 Or B4XPages.MainPage.lat_gps = Null And FLP.GetLastKnownLocation.IsInitialized Then - B4XPages.MainPage.lat_gps = FLP.GetLastKnownLocation.Latitude - B4XPages.MainPage.lon_gps = FLP.GetLastKnownLocation.Longitude - Starter.ubicacionActual = FLP.GetLastKnownLocation - LogColor("Coords en CERO - Guardamos ultima ubicacion conocida", Colors.red) - End If '/////// para la ultima localización FL Dim sDate,sTime As String DateTime.DateFormat = "MM/dd/yyyy" @@ -192,19 +490,18 @@ Sub flp_LocationChanged (Location1 As Location) Dim coords As String = Location1.Latitude&","&Location1.Longitude&","&formatoFecha(Location1.Time) ' Log("Loc changed : "&Location1.Latitude&","&Location1.Longitude&"|"&B4XPages.MainPage.usuario&"|") ' Log("Mandamos Ubicacion") - Log(FirebaseMessaging.locRequest) +' Log(FirebaseMessaging.locRequest) ' Solo mandamos la ubicacion si la precision es menor a XX mts If Location1.Accuracy < 100 Then ' CallSubDelayed2(FirebaseMessaging,"mandamosLoc",coords) End If - If B4XPages.MainPage.cliente.LA_GPS.IsInitialized Then - B4XPages.MainPage.cliente.LA_GPS.Text = "CON UBICACION GPS" - B4XPages.MainPage.cliente.LA_GPS.TextColor = Colors.Black - End If -' LogColor(Location1.Latitude, Colors.red) + CallSub2(Starter, "GPS_LocationChanged", Location1) +' CallSub2(B4XPages.MainPage.cliente, "GPS_LocationChanged", Location1) ' CallSub2(gestion, "GPS_LocationChanged", Location1) - CallSub2(B4XPages.GetPage("Cliente"), "GPS_LocationChanged", Location1) + If B4XPages.MainPage.cliente.IsInitialized Then + CallSub2(B4XPages.GetPage("Cliente"), "GPS_LocationChanged", Location1) + End If ' CallSub2(nuevocliente, "GPS_LocationChanged", Location1) End Sub @@ -212,7 +509,7 @@ Sub CreateNotification (Body As String) As Notification Dim notification As Notification notification.Initialize2(notification.IMPORTANCE_LOW) notification.Icon = "icon" - notification.SetInfo("GUNA", Body, Main) + notification.SetInfo("ADM", Body, Main) Return notification End Sub