mirror of
https://github.com/KeymonSoft/Intmex_Preventa.git
synced 2026-04-17 21:06:12 +00:00
2/9/23 - NotificationService, RespaldoDiario y DBReqServer.
- Se agregó el servicio "NotificationService" para interceptar notificaciones y por medio de un mensaje de WhatsApp (#NS http://10.0.0.205:1782), cambiar el servidor de DBReq. - Se agregó la clase de RespaldoDiario. - Se estandarizó el DBreqServer en Starter.DBReqServer.
This commit is contained in:
@@ -13,15 +13,17 @@ Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
Public gps As GPS
|
||||
Dim skmt As SQL
|
||||
Dim s As C_Subs
|
||||
Dim ph As Phone
|
||||
Public rp As RuntimePermissions
|
||||
Public FLP As FusedLocationProvider
|
||||
' Private flpStarted As Boolean
|
||||
Dim reqManager As DBRequestManager
|
||||
Dim server As String = "http://187.189.244.154:1782"
|
||||
' Dim server As String = "http://187.189.244.154:1783"
|
||||
' Dim server As String = "http://10.0.0.205:1783"
|
||||
' Dim server As String = "http://11.0.0.15:1782"
|
||||
Dim DBReqServer As String = "http://187.189.244.154:1782"
|
||||
' Dim DBReqServer As String = "http://187.189.244.154:1783"
|
||||
' Dim DBReqServer As String = "http://10.0.0.205:1783"
|
||||
' Dim DBReqServer As String = "http://11.0.0.15:1782"
|
||||
Dim Timer1 As Timer
|
||||
Dim Interval As Int = 10
|
||||
Dim ruta As String = File.DirInternal
|
||||
@@ -37,6 +39,8 @@ Sub Service_Create
|
||||
'This is the program entry point.
|
||||
'This is a good place to load resources that are not specific to a single activity.
|
||||
gps.Initialize("GPS")
|
||||
s.Initialize(Me, "Subs") 'Inicializamos la clase Subs
|
||||
skmt = s.inicializaBD(File.DirInternal, "kmt.db")
|
||||
' CallSubDelayed(FirebaseMessaging, "SubscribeToTopics") 'Para Push FirebaseMessaging
|
||||
Timer1.Initialize("Timer1", Interval * 1000)
|
||||
Timer1.Enabled = True
|
||||
@@ -52,7 +56,8 @@ Sub Service_Start (StartingIntent As Intent)
|
||||
Service.StopAutomaticForeground 'Starter service can start in the foreground state in some edge cases.
|
||||
Subs.revisaBD
|
||||
' Log(marcaCel)
|
||||
reqManager.Initialize(Me, server)
|
||||
If s.traeDBReqServerDeBD(skmt) <> "N/A" Then DBReqServer = s.traeDBReqServerDeBD(skmt)
|
||||
reqManager.Initialize(Me, DBReqServer)
|
||||
End Sub
|
||||
|
||||
Private Sub Timer1_Tick
|
||||
@@ -75,9 +80,7 @@ End Sub
|
||||
Sub ENVIA_ULTIMA_GPS
|
||||
Dim logger As Boolean = False
|
||||
If logger Then LogColor("Iniciamos ENVIA_ULTIMA_GPS", Colors.Magenta)
|
||||
Dim skmt As SQL
|
||||
Dim cmd As DBCommand
|
||||
skmt.Initialize(ruta,"kmt.db", False)
|
||||
' cmd.Initialize
|
||||
' cmd.Name = "select_fechat"
|
||||
' B4XPages.MainPage.reqManager.ExecuteQuery(cmd , 0, "fechat")
|
||||
@@ -113,4 +116,13 @@ Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
|
||||
Subs.revisaBD
|
||||
Subs.errorLog.ExecNonQuery2("INSERT INTO errores(fecha, error) VALUES (?,?)", Array As Object (Subs.fechaKMT(DateTime.now), logs))
|
||||
Return True
|
||||
End Sub
|
||||
|
||||
'Inicializa el reqServer con la dirección dada y lo guarda en CAT_VARIABLES.
|
||||
Sub reinicializaReqManager(srv As String)
|
||||
skmt.ExecNonQuery2("delete from CAT_VARIABLES where CAT_VA_DESCRIPCION = ?", Array As Object ("SERVER"))
|
||||
skmt.ExecNonQuery2("INSERT INTO CAT_VARIABLES(CAT_VA_DESCRIPCION, CAT_VA_VALOR) VALUES (?,?)", Array As Object ("SERVER", srv))
|
||||
DBReqServer = srv
|
||||
reqManager.Initialize(Me, srv)
|
||||
' LogColor(srv, Colors.red)
|
||||
End Sub
|
||||
Reference in New Issue
Block a user