28/9/23 - Se agregó´codigo para guardar las geocercas y recibir mensajes push.

- Se agregó la base de datos y el codigo para guardar y administrar las geocercas.
- Se modificó el codigo de los mensajes push recibidos, para que mande una notificación si la ubicación recibida esta dentro de una geocerca.
This commit is contained in:
2023-09-28 03:03:05 -06:00
parent e0bb8ccf21
commit ebe76d6f87
4 changed files with 132 additions and 10 deletions

View File

@@ -138,6 +138,31 @@ Sub centraPanel(elemento As Panel, anchoElementoSuperior As Int) 'ignore
elemento.Left = Round(anchoElementoSuperior/2)-(elemento.Width/2)
End Sub
'Inicializa la BD con "kmt.db" en File.DirInternal, si el archivo no existe, lo copia desde File.DirAssets.
'Dispara el evento "dbOk" cuando termina.
Sub dbInit As SQL
Private db As SQL
' If File.Exists(File.DirInternal, "push.db") = False Then File.Copy(File.DirAssets, "push.db", File.DirInternal, "kmt.db")
db.Initialize(File.DirInternal,"push.db", True)
db.ExecNonQuery("CREATE TABLE IF NOT EXISTS geocercas (nombre TEXT, lat TEXT, lon TEXT)")
Return db
End Sub
'Genera una notificacion con importancia alta
Sub notiHigh(title As String, body As String, id As String, activity As Object) 'ignore
activity = Main
Private notif As Notification
notif.Initialize2(notif.IMPORTANCE_HIGH)
notif.Icon = "icon"
notif.Vibrate = False
notif.Sound = False
notif.AutoCancel = True
' If logger Then Log("notiHigh: "&title)
notif.SetInfo(title, body, activity)
' Log("notiHigh SetInfo")
notif.Notify(id)
End Sub
'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.
'Point 1 Is also Point 5 (first point And last point are same value).