Cambios en como se reciben y reacciona a actualizaciones.

This commit is contained in:
2023-09-30 06:02:40 -06:00
parent ebe76d6f87
commit 8b001e88c8
5 changed files with 153 additions and 51 deletions

Binary file not shown.

View File

@@ -32,49 +32,74 @@ Sub Service_Start (StartingIntent As Intent)
End Sub End Sub
Sub fm_MessageArrived (Message As RemoteMessage) Sub fm_MessageArrived (Message As RemoteMessage)
Log("Mensaje recibido") Log($"Pusher - Mensaje recibido: ${Message.GetData}"$)
Log($"Message data: ${Message.GetData}"$) ' Log($"Message data: ${Message.GetData}"$)
'Si recibimos Pong, lo agregamos a la lista de dispositivos activos 'Si recibimos Pong, lo agregamos a la lista de dispositivos activos
If Message.GetData.ContainsKey("t") And Message.GetData.Get("t") = "pong" Then If Message.GetData.ContainsKey("t") And Message.GetData.Get("t") = "pong" Then
Log("Recibimos pong "&Message.GetData.Get("d")) Log("Pusher - Recibimos pong "&Message.GetData.Get("d"))
If Main.dispositivos.ContainsKey(Message.GetData.Get("d")) Then If Main.dispositivos.ContainsKey(Message.GetData.Get("d")) Then
Dim dMap As Map = Main.dispositivos.Get(Message.GetData.Get("d")) Dim dMap As Map = Main.dispositivos.Get(Message.GetData.Get("d"))
Dim dispData As Map = dMap Dim dispData As Map = dMap
Else Else
Dim dispData As Map = CreateMap("coords": "0,0", "d": Message.GetData.Get("d"),"v": Message.GetData.Get("v"), "w": Message.GetData.Get("w")) Dim dispData As Map = CreateMap("coords": "0,0", "d": Message.GetData.Get("d"),"v": Message.GetData.Get("v"), "w": Message.GetData.Get("w"))
End If End If
Log("** "&dispData) ' Log("** "&dispData)
Main.dispositivos.Put(Message.GetData.Get("d"), dispData) Main.dispositivos.Put(Message.GetData.Get("d"), dispData)
End If End If
'Si el mensaje es de ubicacion recibida 'Si el mensaje es de ubicacion recibida
If Message.GetData.ContainsKey("t") And (Message.GetData.Get("t") = "u" Or Message.GetData.Get("t") = "au") Then If Message.GetData.ContainsKey("t") And (Message.GetData.Get("t") = "u" Or Message.GetData.Get("t") = "au") Then
Log("Recibimos ubicacion") Log("Pusher - Recibimos ubicacion")
Private ubi As Location Private ubi As Location
Log("Llamamos UbicacionRecibida") ' Log("Llamamos UbicacionRecibida")
If Message.GetData.Get("t") = "au" Then If Message.GetData.Get("t") = "au" Or Message.GetData.Get("t") = "u" Then
' ToastMessageShow("Ubicacion recibida:"&Message.GetData.Get("body"),False) ' ToastMessageShow("Ubicacion recibida:"&Message.GetData.Get("body"),False)
Private coords() As String = Regex.split(",", Message.GetData.Get("body")) Private coords() As String = Regex.split(",", Message.GetData.Get("body"))
ubi.Initialize ubi.Initialize
ubi.Latitude = coords(0) If Message.GetData.Get("body") <> "" Then
ubi.Longitude = coords(1) ubi.Latitude = coords(0)
ubi.Longitude = coords(1)
Else
ubi.Latitude = 0
ubi.Longitude = 0
End If
' ubi.Longitude = coords(1)
Private c As Cursor = db.ExecQuery("select * from geocercas") 'Traemos las geocercas Private c As Cursor = db.ExecQuery("select * from geocercas") 'Traemos las geocercas
Private estaGC As Location Private estaGC As Location
Private enGoecerca As Boolean = False
Private nuevoEnGoecerca As Boolean = False
If c.RowCount > 0 Then If c.RowCount > 0 Then
For i = 0 To c.RowCount - 1 For i = 0 To c.RowCount - 1
c.Position = i c.Position = i
estaGC.Initialize estaGC.Initialize
estaGC.Latitude = c.GetString("lat") estaGC.Latitude = c.GetString("lat")
estaGC.Longitude = c.GetString("lon") estaGC.Longitude = c.GetString("lon")
Log(ubi & "|" & estaGC) ' Log(ubi & "|" & estaGC)
Log(ubi.DistanceTo(estaGC)) ' Log(ubi.DistanceTo(estaGC))
If ubi.DistanceTo(estaGC) < 300 Then 'Revisamos si la ubicaccion recibida esta dentro de alguna geocerca. If ubi.DistanceTo(estaGC) < 300 Then 'Revisamos si la ubicaccion recibida esta dentro de alguna geocerca.
' ToastMessageShow($"Dentro de ${c.GetString("nombre")}"$, False) ' ToastMessageShow($"Dentro de ${c.GetString("nombre")}"$, False)
Subs.notiHigh("Dentro de Geocerca", $"${Message.GetData.Get("d")} esta dentro de ${c.GetString("nombre")}"$, 777, "Main") enGoecerca = True
If Not(Starter.dentroDeGeocerca.ContainsKey(Message.GetData.Get("d"))) Then
Starter.dentroDeGeocerca.Put(Message.GetData.Get("d"), c.GetString("nombre"))
nuevoEnGoecerca = True
End If
' Log(nuevoEnGoecerca)
' notiBigText("Dentro de Geocerca", $"${Message.GetData.Get("d")} esta dentro de ${c.GetString("nombre")}"$, 777, "Main")
End If End If
Next Next
End If End If
If Not(enGoecerca) Then
Starter.dentroDeGeocerca.Remove(Message.GetData.Get("d"))
' Log(Starter.dentroDeGeocerca)
End If
Private textoNoti As String = ""
For Each key As String In Starter.dentroDeGeocerca.Keys
' Log(Starter.dentroDeGeocerca.Get(key))
textoNoti = $"${textoNoti}${CRLF}${key} - ${Starter.dentroDeGeocerca.Get(key)} "$
Next
If nuevoEnGoecerca Then notiBigText("Geocercas", $"${textoNoti}"$, 777, "Main")
' LogColor("****** " & Starter.dentroDeGeocerca, Colors.blue)
' Subs.notiHigh("Dentro de Geocerca", $"${Message.GetData.Get("d")} esta dentro de ${c.GetString("nombre")}"$, 777, "Main") ' Subs.notiHigh("Dentro de Geocerca", $"${Message.GetData.Get("d")} esta dentro de ${c.GetString("nombre")}"$, 777, "Main")
End If End If
CallSub2(Main, "ubicacionRecibida", Message.GetData) CallSub2(Main, "ubicacionRecibida", Message.GetData)
@@ -99,6 +124,17 @@ Sub Service_Destroy
End Sub End Sub
Sub notiBigText(title2 As String, body2 As String, id2 As String, act As Object)
Dim smiley As Bitmap = LoadBitmapResize(File.DirAssets, "logo_keymon.png", 24dip, 24dip, False)
Dim n As NB6
n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)
' Dim cs As CSBuilder
n.BigTextStyle("Geocercas", "", "")
n.OnGoing(True)
' n.SetDefaults(true, True, True)
n.Build(title2, body2, "tag", act).Notify(id2)
End Sub
Sub descomprimeRuta Sub descomprimeRuta
Dim su As StringUtils Dim su As StringUtils
Dim decompressedbytes() As Byte = su.DecodeBase64(Main.base64) Dim decompressedbytes() As Byte = su.DecodeBase64(Main.base64)

View File

@@ -1,15 +1,17 @@
Build1=Default,pusher.chv.com Build1=Default,pusher.chv.com
File1=96761371-car-icon-white-icon-with-shadow-on-transparent-background.jpg File1=96761371-car-icon-white-icon-with-shadow-on-transparent-background.jpg
File10=marker-rojo-0.png File10=logo_keymon.png
File11=marker-rojo-coche.png File11=marker-rojo-0.png
File12=waze.png File12=marker-rojo-coche.png
File13=waze-moving.png File13=smiley.png
File14=waze-moving-2.png File14=waze.png
File15=waze-moving-small.png File15=waze-moving.png
File16=waze-sleeping.png File16=waze-moving-2.png
File17=waze-sleeping-small.png File17=waze-moving-small.png
File18=zzz.png File18=waze-sleeping.png
File19=waze-sleeping-small.png
File2=ballon280.png File2=ballon280.png
File20=zzz.png
File3=ballon50.png File3=ballon50.png
File4=balloon_overlay_close.png File4=balloon_overlay_close.png
File5=datetimelayout.bal File5=datetimelayout.bal
@@ -27,7 +29,9 @@ FileGroup15=Default Group
FileGroup16=Default Group FileGroup16=Default Group
FileGroup17=Default Group FileGroup17=Default Group
FileGroup18=Default Group FileGroup18=Default Group
FileGroup19=Default Group
FileGroup2=Default Group FileGroup2=Default Group
FileGroup20=Default Group
FileGroup3=Default Group FileGroup3=Default Group
FileGroup4=Default Group FileGroup4=Default Group
FileGroup5=Default Group FileGroup5=Default Group
@@ -48,9 +52,10 @@ Library17=randomaccessfile
Library18=reflection Library18=reflection
Library19=runtimepermissions Library19=runtimepermissions
Library2=byteconverter Library2=byteconverter
Library20=xcustomlistview Library20=sql
Library21=xui Library21=xcustomlistview
Library22=sql Library22=xui
Library23=nb6
Library3=compressstrings Library3=compressstrings
Library4=core Library4=core
Library5=dateutils Library5=dateutils
@@ -65,15 +70,15 @@ Module3=Mods
Module4=MyPopup Module4=MyPopup
Module5=Starter Module5=Starter
Module6=Subs Module6=Subs
NumberOfFiles=18 NumberOfFiles=20
NumberOfLibraries=22 NumberOfLibraries=23
NumberOfModules=6 NumberOfModules=6
Version=12.5 Version=12.5
@EndOfDesignText@ @EndOfDesignText@
#Region Project Attributes #Region Project Attributes
#ApplicationLabel: Pusher 2.0 #ApplicationLabel: Pusher 2.0
#VersionCode: 1 #VersionCode: 1
#VersionName: 3.09.27 #VersionName: 3.09.29
'Ver. 3.09.18 - Se agregó la posibilidad de mostrar puntos internedios en la ruta y muestra icono diferente si esta en movimiento o parado. 'Ver. 3.09.18 - Se agregó la posibilidad de mostrar puntos internedios en la ruta y muestra icono diferente si esta en movimiento o parado.
'SupportedOrientations possible values: unspecified, landscape or portrait. 'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait #SupportedOrientations: portrait
@@ -126,12 +131,12 @@ Sub Process_Globals
Private hInicio, hFinal As String Private hInicio, hFinal As String
Private distanciaRecorrida As String = "0" Private distanciaRecorrida As String = "0"
Private usuario As String Private usuario As String
dim punto as LatLng Dim punto As LatLng
End Sub End Sub
Sub Globals Sub Globals
'These global variables will be redeclared each time the activity is created. 'These global variables will be redeclared each time the activity is created.
Private gmap As GoogleMap Private gmap, gmap2 As GoogleMap
Dim MapFragment1 As MapFragment Dim MapFragment1 As MapFragment
Dim latmarker As String Dim latmarker As String
Dim longmarker As String Dim longmarker As String
@@ -326,6 +331,7 @@ Sub JobDone(Job As HttpJob)
End If End If
Private d As String = records(result.Columns.Get("DATOS")) & "," & records(result.Columns.Get("FECHA")) Private d As String = records(result.Columns.Get("DATOS")) & "," & records(result.Columns.Get("FECHA"))
Private l As List = Regex.Split(",", d) Private l As List = Regex.Split(",", d)
' Log(rutaSeleccionada)
estasCoords.Initialize estasCoords.Initialize
estasCoords.Latitude = l.Get(0) estasCoords.Latitude = l.Get(0)
estasCoords.Longitude = l.Get(1) estasCoords.Longitude = l.Get(1)
@@ -349,6 +355,7 @@ Sub JobDone(Job As HttpJob)
fechaFinRutaGPS = DateTime.Date(fechaFinRutaGPS) & ", " & DateTime.Time(fechaFinRutaGPS) fechaFinRutaGPS = DateTime.Date(fechaFinRutaGPS) & ", " & DateTime.Time(fechaFinRutaGPS)
Next Next
Private estaGC As Location Private estaGC As Location
Private enGeocerca As Boolean = False
If c.RowCount > 0 Then If c.RowCount > 0 Then
For i = 0 To c.RowCount - 1 For i = 0 To c.RowCount - 1
c.Position = i c.Position = i
@@ -356,17 +363,32 @@ Sub JobDone(Job As HttpJob)
estaGC.Latitude = c.GetString("lat") estaGC.Latitude = c.GetString("lat")
estaGC.Longitude = c.GetString("lon") estaGC.Longitude = c.GetString("lon")
' Log(estasCoords & "|" & thisGC) ' Log(estasCoords & "|" & thisGC)
Log(estasCoords.DistanceTo(estaGC)) ' Log(estasCoords.DistanceTo(estaGC))
If estasCoords.DistanceTo(estaGC) < 300 Then If estasCoords.DistanceTo(estaGC) < 300 Then
ToastMessageShow($"Dentro de ${c.GetString("nombre")}"$, False) ToastMessageShow($"Dentro de ${c.GetString("nombre")}"$, False)
' Subs.notiHigh("Dentro de Geocerca", $"${usuario} esta dentro de ${c.GetString("nombre")}"$, 777, "Main") Starter.dentroDeGeocerca.Put(usuario, c.GetString("nombre"))
' Log("+*************** " & Starter.dentroDeGeocerca)
' Subs.notiHigh($"Geocerca"$, $"${usuario} esta dentro de ${c.GetString("nombre")}"$, 777, "Main")
enGeocerca = True
End If End If
Next Next
End If End If
If Not(enGeocerca) Then
Starter.dentroDeGeocerca.Remove(usuario)
Log(Starter.dentroDeGeocerca)
' Subs.notiHigh("Geocercas", $"${usuario} salió de geocerca."$, 777, "Main")
End If
Private textoNoti As String = ""
For Each key As String In Starter.dentroDeGeocerca.Keys
' Log(Starter.dentroDeGeocerca.Get(key))
textoNoti = $"${textoNoti}${CRLF}${key} - ${Starter.dentroDeGeocerca.Get(key)} "$
Next
' Log(textoNoti)
notiBigText("Geocercas", $"${textoNoti}"$, 777, "Main")
c.Close c.Close
ToastMessageShow("Recibimos ruta con " & reqManager.HandleJob(Job).Rows.Size & " puntos.", False) ToastMessageShow("Recibimos ruta con " & reqManager.HandleJob(Job).Rows.Size & " puntos.", False)
' Log(rutaGPS) ' Log(rutaGPS)
LogColor($"Distancia recorrida: $1.1{distanciaRecorrida/1000} kms."$, Colors.Magenta) ' LogColor($"Distancia recorrida: $1.1{distanciaRecorrida/1000} kms."$, Colors.Magenta)
l_distanciaRecorrida.Text = $"Dist. recorrida: $1.1{distanciaRecorrida/1000} kms."$ l_distanciaRecorrida.Text = $"Dist. recorrida: $1.1{distanciaRecorrida/1000} kms."$
muestraRuta muestraRuta
End If End If
@@ -377,7 +399,7 @@ Sub JobDone(Job As HttpJob)
s_rutas.Add("Selecciona") s_rutas.Add("Selecciona")
For Each records() As Object In result.Rows For Each records() As Object In result.Rows
For Each k As String In result.Columns.Keys For Each k As String In result.Columns.Keys
Log(result.Tag & ": " & k & ": " & records(result.Columns.Get(k))) ' Log(result.Tag & ": " & k & ": " & records(result.Columns.Get(k)))
s_rutas.Add(records(result.Columns.Get(k))) s_rutas.Add(records(result.Columns.Get(k)))
Next Next
Next Next
@@ -387,6 +409,17 @@ Sub JobDone(Job As HttpJob)
Job.Release Job.Release
End Sub End Sub
Sub notiBigText(title2 As String, body2 As String, id2 As String, act As Object)
Dim smiley As Bitmap = LoadBitmapResize(File.DirAssets, "logo_keymon.png", 24dip, 24dip, False)
Dim n As NB6
n.Initialize("default", Application.LabelName, "HIGH").SmallIcon(smiley)
' Dim cs As CSBuilder
n.BigTextStyle("Geocercas", "", "")
n.OnGoing(True)
' n.SetDefaults(true, True, True)
n.Build(title2, body2, "tag", act).Notify(id2)
End Sub
public Sub ubicacionRecibida(message As Map) public Sub ubicacionRecibida(message As Map)
'Aqui mostramos la ubicacion recibida en el mapa 'Aqui mostramos la ubicacion recibida en el mapa
Dim coords As List = Regex.Split(",",message.Get("body")) Dim coords As List = Regex.Split(",",message.Get("body"))
@@ -415,7 +448,7 @@ public Sub ubicacionRecibida(message As Map)
Dim dispData As Map = CreateMap("coords" : coords.Get(0)&","&coords.Get(1), "tm" : timemarker, "d" : message.Get("d"), "b" : batt, "w" : wifi, "mt" : montoTotal, "v" : v) Dim dispData As Map = CreateMap("coords" : coords.Get(0)&","&coords.Get(1), "tm" : timemarker, "d" : message.Get("d"), "b" : batt, "w" : wifi, "mt" : montoTotal, "v" : v)
dispositivos.Put(message.Get("d"), dispData) dispositivos.Put(message.Get("d"), dispData)
' Log("dispositvos="&dispositivos) ' Log("dispositvos="&dispositivos)
Log(DateTime.Time(timemarker)) ' Log(DateTime.Time(timemarker))
MapFragment1_Ready MapFragment1_Ready
Log("Dispositivos : "&dispositivos.Size) Log("Dispositivos : "&dispositivos.Size)
End Sub End Sub
@@ -449,7 +482,7 @@ Sub agregaAListview
Next Next
cuantos.Text = "Rutas"&CRLF&ListView1.Size cuantos.Text = "Rutas"&CRLF&ListView1.Size
ubicados.Text = "Ubicados"&CRLF&dUbicados ubicados.Text = "Ubicados"&CRLF&dUbicados
Log("dUbicados="&dUbicados) ' Log("dUbicados="&dUbicados)
End Sub End Sub
Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int) Sub IME_HeightChanged(NewHeight As Int, OldHeight As Int)
@@ -520,7 +553,6 @@ Sub MapFragment1_Ready
'/////////////////////////////////////////// '///////////////////////////////////////////
Dim GoogleMapsExtras1 As GoogleMapsExtras Dim GoogleMapsExtras1 As GoogleMapsExtras
Dim InfoWindowAdapter1 As InfoWindowAdapter Dim InfoWindowAdapter1 As InfoWindowAdapter
InfoWindowAdapter1.Initialize("InfoWindowAdapter1") InfoWindowAdapter1.Initialize("InfoWindowAdapter1")
GoogleMapsExtras1.SetInfoWindowAdapter(gmap, InfoWindowAdapter1) GoogleMapsExtras1.SetInfoWindowAdapter(gmap, InfoWindowAdapter1)
InfoWindowPanel.Initialize("") InfoWindowPanel.Initialize("")
@@ -557,6 +589,21 @@ Sub MapFragment1_Ready
' Subs.mueveCamaraMapa(MapFragment1, latmarker, longmarker) ' Subs.mueveCamaraMapa(MapFragment1, latmarker, longmarker)
End Sub End Sub
Sub MapFragment2_Ready
gmap2 = MapFragment2.GetMap
'///////////////////////////////////////////
Dim GoogleMapsExtras2 As GoogleMapsExtras
Dim InfoWindowAdapter2 As InfoWindowAdapter
InfoWindowAdapter2.Initialize("InfoWindowAdapter1")
GoogleMapsExtras2.SetInfoWindowAdapter(gmap2, InfoWindowAdapter2)
InfoWindowPanel.Initialize("")
InfoWindowPanel.LoadLayout("InfoWindow")
' a hack(ish) way to set InfoWindowPanel width and height!
MapPanel.AddView(InfoWindowPanel, 0, 0, 190dip, 80dip)
InfoWindowPanel.RemoveView
'/////////////////////////////////////////////
End Sub
Sub MapFragment2_LongClick(Point As LatLng) Sub MapFragment2_LongClick(Point As LatLng)
Log("LONG: " & Point) Log("LONG: " & Point)
p_addGeofence.BringToFront p_addGeofence.BringToFront
@@ -575,22 +622,33 @@ Sub InfoWindowAdapter1_GetInfoContents(Marker1 As Marker) As View
Return InfoWindowPanel Return InfoWindowPanel
End Sub End Sub
Sub InfoWindowAdapter2_GetInfoContents(Marker1 As Marker) As View
' the default InfoContent will be used if this event Sub is not defined or if it returns Null
' Log("InfoWindowAdapter1_GetInfoContents")
TitleLabel.Text=Marker1.Title
SnippetLabel.Text=Marker1.Snippet
' ThumbImage.Bitmap=? how will you store the file path/file name of the image to display?
' it's a shame that the Marker object has no Tag property which could be used to store such info
Return InfoWindowPanel
End Sub
Sub muestraRuta Sub muestraRuta
' Log("iniciamos MuestraRuta") Log("-------- = iniciamos MuestraRuta")
MapFragment2_Ready
Private estasCoords, coordsAnt As Location Private estasCoords, coordsAnt As Location
coordsAnt.Initialize coordsAnt.Initialize
estasCoords.Initialize estasCoords.Initialize
' If lineAnt.IsInitialized Then lineAnt.Visible = False 'Ocultamos ruta anterior ' If lineAnt.IsInitialized Then lineAnt.Visible = False 'Ocultamos ruta anterior
If mapaDestino = 1 Then If mapaDestino = 1 Then
gmap = MapFragment1.GetMap gmap2 = MapFragment1.GetMap
Else Else
gmap = MapFragment2.GetMap gmap2 = MapFragment2.GetMap
End If End If
Dim points As List Dim points As List
Dim point As LatLng Dim point As LatLng
Dim lat1, lon1, latIn, lonIn, latOut, lonOut As Double Dim lat1, lon1, latIn, lonIn, latOut, lonOut As Double
line=gmap.AddPolyline line = gmap2.AddPolyline
line.Width=10 line.Width = 10
' Log("Color ruta") ' Log("Color ruta")
'Cambiamos el color de la ruta cada vez que se solicite una nueva 'Cambiamos el color de la ruta cada vez que se solicite una nueva
If colorAnt = 1 Then line.color=Colors.RGB(255, 54, 54) ' Rojo If colorAnt = 1 Then line.color=Colors.RGB(255, 54, 54) ' Rojo
@@ -614,7 +672,7 @@ Sub muestraRuta
listtemp = Regex.Split(CRLF, rutaGPS) listtemp = Regex.Split(CRLF, rutaGPS)
' Log(listtemp.Size) ' Log(listtemp.Size)
For i = 1 To listtemp.Size-1 For i = 1 To listtemp.Size-1
Dim coords() As String = Regex.Split(",",listtemp.Get(i)) Dim coords() As String = Regex.Split(",", listtemp.Get(i))
If i = 1 Then If i = 1 Then
latIn = coords(0) latIn = coords(0)
lonIn = coords(1) lonIn = coords(1)
@@ -634,11 +692,11 @@ Sub muestraRuta
DateTime.timeformat = "HH:mm" DateTime.timeformat = "HH:mm"
hora = DateTime.Time(hora) hora = DateTime.Time(hora)
If speedOut > 0.5 Then If speedOut > 0.5 Then
Marker0 = gmap.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-moving-small.png")) Marker0 = gmap2.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-moving-small.png"))
Else Else
Marker0 = gmap.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-sleeping-small.png")) Marker0 = gmap2.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-sleeping-small.png"))
End If End If
Marker0.Snippet = "Hora: " & hora & ", Vel.: " & NumberFormat2((speedOut * 3.6), 1, 2, 2, True) & " km/h" Marker0.Snippet = "Hora: " & hora & CRLF &"Velocidad: " & NumberFormat2((speedOut * 3.6), 1, 2, 2, True) & " km/h"
End If End If
lat1 = coords(0) lat1 = coords(0)
lon1 = coords(1) lon1 = coords(1)
@@ -652,7 +710,7 @@ Sub muestraRuta
Dim data As Map = CreateMap("ruta" : line) Dim data As Map = CreateMap("ruta" : line)
rutasGPS.Put(rRuta, data) rutasGPS.Put(rRuta, data)
' Log(rutasGPS) ' Log(rutasGPS)
Log("Puntos : "&listtemp.Size) ' Log("Puntos : "&listtemp.Size)
' ToastMessageShow("Recibimos ruta con "&listtemp.Size&" puntos", True) ' ToastMessageShow("Recibimos ruta con "&listtemp.Size&" puntos", True)
rutaAnt = rRuta ' Ponemos en rutaAnt la ruta actual rutaAnt = rRuta ' Ponemos en rutaAnt la ruta actual
'Mueve el mapa a las ultmas coordenadas de la ruta 'Mueve el mapa a las ultmas coordenadas de la ruta
@@ -661,17 +719,17 @@ Sub muestraRuta
Else 'Los puntos de la ruta de la base de datos se traen en orden ascendente (los mas viejos primero) Else 'Los puntos de la ruta de la base de datos se traen en orden ascendente (los mas viejos primero)
Subs.mueveCamaraMapa(MapFragment2, latOut, lonOut) Subs.mueveCamaraMapa(MapFragment2, latOut, lonOut)
Dim Marker1 As Marker Dim Marker1 As Marker
' Marker1 = gmap.AddMarker(latOut, lonOut, "Fin " & usuario) ' Marker1 = gmap2.AddMarker(latOut, lonOut, "Fin " & usuario)
If speedOut > 1 Then If speedOut > 1 Then
Marker1 = gmap.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-moving.png")) Marker1 = gmap2.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-moving.png"))
Else Else
Marker1 = gmap.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-sleeping.png")) Marker1 = gmap2.AddMarker3(latOut, lonOut, "Fin " & usuario, LoadBitmap(File.DirAssets, "waze-sleeping.png"))
End If End If
' Marker1.Title = "Fin " & usuario ' Marker1.Title = "Fin " & usuario
Marker1.Snippet = "Fecha: " & fechaFinRutaGPS & ", Vel.: " & NumberFormat2((speedOut * 3.6), 1, 2, 2, True) & " km/h" Marker1.Snippet = "Fecha: " & fechaFinRutaGPS & CRLF & "Velocidad: " & NumberFormat2((speedOut * 3.6), 1, 2, 2, True) & " km/h"
Dim Marker0 As Marker Dim Marker0 As Marker
Marker0 = gmap.AddMarker2(latIn, lonIn, "Inicio " & usuario, gmap.HUE_GREEN) Marker0 = gmap2.AddMarker2(latIn, lonIn, "Inicio " & usuario, gmap2.HUE_GREEN)
' Marker0.Title = "Inicio " & usuario ' Marker0.Title = "Inicio " & usuario
Marker0.Snippet = $"Fecha: ${fechaInicioRutaGPS}"$ Marker0.Snippet = $"Fecha: ${fechaInicioRutaGPS}"$
End If End If

View File

@@ -12,10 +12,12 @@ Version=9.9
Sub Process_Globals Sub Process_Globals
Public rp As RuntimePermissions Public rp As RuntimePermissions
Public FLP As FusedLocationProvider Public FLP As FusedLocationProvider
Dim dentroDeGeocerca As Map
End Sub End Sub
Sub Service_Create Sub Service_Create
CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") CallSubDelayed(FirebaseMessaging, "SubscribeToTopics")
dentroDeGeocerca.Initialize
End Sub End Sub
Sub Service_Start (StartingIntent As Intent) Sub Service_Start (StartingIntent As Intent)

View File

@@ -153,6 +153,7 @@ Sub notiHigh(title As String, body As String, id As String, activity As Object)
activity = Main activity = Main
Private notif As Notification Private notif As Notification
notif.Initialize2(notif.IMPORTANCE_HIGH) notif.Initialize2(notif.IMPORTANCE_HIGH)
notif.OnGoingEvent = True
notif.Icon = "icon" notif.Icon = "icon"
notif.Vibrate = False notif.Vibrate = False
notif.Sound = False notif.Sound = False
@@ -163,6 +164,11 @@ Sub notiHigh(title As String, body As String, id As String, activity As Object)
notif.Notify(id) notif.Notify(id)
End Sub End Sub
Sub cancelNoti(id) 'ignore
Private notif As Notification 'ignore
notif.Cancel(id)
End Sub
'Geo-Zone Determination (Point in Polygon) 'Geo-Zone Determination (Point in Polygon)
'Use this to determine If a vehicle is within a defined zone made of 5 or more lat/lon coordinates. 'Use this to determine If a vehicle is within a defined zone made of 5 or more lat/lon coordinates.
'Point 1 Is also Point 5 (first point And last point are same value). 'Point 1 Is also Point 5 (first point And last point are same value).