mirror of
https://github.com/KeymonSoft/Monitor-Keymon.git
synced 2026-04-18 05:09:21 +00:00
- 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.
55 lines
1.9 KiB
QBasic
55 lines
1.9 KiB
QBasic
B4A=true
|
|
Group=Default Group
|
|
ModulesStructureVersion=1
|
|
Type=Service
|
|
Version=11
|
|
@EndOfDesignText@
|
|
#Region Service Attributes
|
|
#StartAtBoot: False
|
|
#End Region
|
|
|
|
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 ultimaNoti As String
|
|
End Sub
|
|
|
|
Sub Service_Create
|
|
rp.Initialize("MonitorKeymon")
|
|
If Starter.logger Then Log("**************** Iniciamos Monitor Keymon ***********************")
|
|
End Sub
|
|
|
|
Sub Service_Start (StartingIntent As Intent)
|
|
Log("Monitor - NotificationService Start")
|
|
If rp.HandleIntent(StartingIntent) Then Return
|
|
DateTime.DateFormat = "mm"
|
|
ultimaNoti = DateTime.Date(DateTime.now)
|
|
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)
|
|
' 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
|