- VERSION 4.12.11

- Se volvio a incluir la libreria de intercepcion de notificaciones (ReplyAuto) para ayudar a mantener activa la aplicacion.
- Su gregaron bloques de try/catch para evitar que se generen errores cuando los servicios modifican la pantalla principal (mainpage) y la aplicacion esta en segundo plano.
This commit is contained in:
Jose Alberto Guerra Ugalde
2024-12-11 06:16:22 -06:00
parent 2a8bfcc967
commit baa8f9bbd8
7 changed files with 196 additions and 180 deletions

View File

@@ -11,44 +11,44 @@ Version=11
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
' Dim rp As ReplyAuto
' Dim activo As Boolean = True
Dim rp As ReplyAuto
Dim activo As Boolean = True
Dim ultimaNoti As String
Dim logger As Boolean = False
End Sub
Sub Service_Create
' rp.Initialize("MonitorKeymon")
#if not(DEBUG)
logger = False
#end if
If logger Then Log("**************** Iniciamos Monitor Keymon ***********************")
rp.Initialize("MonitorKeymon")
If Starter.logger Then Log("**************** Iniciamos Monitor Keymon ***********************")
End Sub
Sub Service_Start (StartingIntent As Intent)
' Log("NotificationService Start")
' If rp.HandleIntent(StartingIntent) Then Return
Log("Monitor - NotificationService Start")
If rp.HandleIntent(StartingIntent) Then Return
DateTime.DateFormat = "mm"
ultimaNoti = DateTime.Date(DateTime.now)
If logger Then LogColor($"Ultima notificación en el minuto ${ultimaNoti}"$, Colors.green)
If Starter.logger Then LogColor($"Ultima notificación en el minuto ${ultimaNoti}"$, Colors.green)
End Sub
Sub Service_Destroy
End Sub
'Sub MonitorKeymon_NotificationPosted (SBN As StatusBarNotification)
' If ultimaNoti = "" Then ultimaNoti = 0
' DateTime.DateFormat = "mm"
' Private estaNoti As String = DateTime.Date(DateTime.now)
' If estaNoti > 60 Then estaNoti = estaNoti - 60
' If logger Then LogColor("Diferencia de tiempo entre notis = " & (estaNoti - ultimaNoti), Colors.blue)
' If logger Then LogColor($"Esta noti en el minuto ${DateTime.Date(DateTime.now)}, ultima noti = ${ultimaNoti}"$, Colors.green)
' If logger Then Log(SBN.PackageName)
' If ultimaNoti < estaNoti Then
' If logger Then LogColor($"******** TIEMPO *******"$, Colors.red)
' ultimaNoti = estaNoti
' If IsPaused(Monitor) Then StartService(Monitor)
' End If
' If logger Then LogColor("Monitor inicializado:" & Monitor.Timer1.IsInitialized, Colors.Magenta)
'End Sub
Sub MonitorKeymon_NotificationPosted (SBN As StatusBarNotification)
' Log("|" & ultimaNoti & "|")
If ultimaNoti = "" Then ultimaNoti = 0
DateTime.DateFormat = "mm"
Private estaNoti As String = DateTime.Date(DateTime.now)
' Log("|" & estaNoti & "|")
If estaNoti > 60 Then estaNoti = estaNoti - 60
' Log("|" & estaNoti & "|")
If Starter.logger Then LogColor("Diferencia de tiempo entre notis = " & (estaNoti - ultimaNoti), Colors.blue)
If Starter.logger Then LogColor($"Esta noti en el minuto ${DateTime.Date(DateTime.now)}, ultima noti = ${ultimaNoti}"$, Colors.green)
If Starter.logger Then Log(SBN.PackageName)
If (ultimaNoti + 2) < estaNoti Then '3 minutos
If Starter.logger Then LogColor($"******** Revisamos el Monitor *******"$, Colors.red)
ultimaNoti = estaNoti
If Starter.logger Then Log($"Monitor activo: ${Not(IsPaused(Monitor))}"$)
If IsPaused(Monitor) Then StartService(Monitor)
End If
If Starter.logger Then LogColor("Monitor inicializado: " & Monitor.Timer1.IsInitialized, Colors.Magenta)
End Sub