17/9/23 - Permisos de notificacion y timeout

- Se puso codigo para que al iniciar la aplicación pida el acceso a notificaciones.
- Se cambió el timeout por default a 11 segs.
This commit is contained in:
2023-09-17 17:14:02 -06:00
parent 1bbd6d2653
commit 24ab38a661
5 changed files with 14 additions and 6 deletions

View File

@@ -85,6 +85,11 @@ Sub B4XPage_Appear
s.centraPanel(p_intervalo, Root.Width)
s.centraEtiqueta(Label1, Root.Width)
If Not(CheckNotificationAccess) Then
Msgbox2Async($"Se necesita acceso a las notificaciones, haga clic en "Aceptar" y en la siguiente pantalla permita el acceso a la aplicación "${Application.LabelName}"."$, "Permisos necesarios", "Aceptar", "Cancelar", "", Null, True)
Wait For Msgbox_Result (resultado As Int)
If resultado = DialogResponse.POSITIVE Then
b_notifAccess_Click
End If
Private cd1 As ColorDrawable
cd1.Initialize(Colors.red, 10dip)
b_notifAccess.Background = cd1

View File

@@ -399,9 +399,9 @@ Sub traeIntervaloDeBD As String 'ignore
Return intrvl
End Sub
'Regresa el timeout desde la base de datos o "9000" si no existe.
'Regresa el timeout desde la base de datos o "11000" si no existe.
Sub traeTimeoutDeBD As String 'ignore
Dim tmout As String = "9000"
Dim tmout As String = "11000"
Dim rs As ResultSet = Starter.skmt.ExecQuery("select valor from cat_variables where nombre = 'timeout'")
If rs.RowCount > 0 Then
rs.NextRow

View File

@@ -31,12 +31,12 @@ Module7=Starter
NumberOfFiles=4
NumberOfLibraries=12
NumberOfModules=7
Version=12.2
Version=12.5
@EndOfDesignText@
#Region Project Attributes
#ApplicationLabel: Monitor Keymon
#VersionCode: 1
#VersionName: 3.09.10
#VersionName: 3.09.17
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: False

View File

@@ -26,10 +26,11 @@ Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
' Log("NotificationService Start")
If rp.HandleIntent(StartingIntent) Then Return
DateTime.DateFormat = "mm"
ultimaNoti = DateTime.Date(DateTime.now)
If logger Then LogColor($"Ultima noti en el minuto ${ultimaNoti}"$, Colors.green)
If logger Then LogColor($"Ultima notificación en el minuto ${ultimaNoti}"$, Colors.green)
End Sub
Sub Service_Destroy

View File

@@ -41,9 +41,10 @@ Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
Log("Monitor Start")
Service.StopAutomaticForeground 'Call this when the background task completes (if there is one)
Service.StartForeground(nid, s.CreateNotification("..."))
StartServiceAt(Me, DateTime.Now + 1 * DateTime.TicksPerMinute, True)
StartServiceAt(Me, DateTime.Now + 10 * DateTime.TicksPerMinute, True)
reqManager.Initialize(Me, Starter.DBReqServer)
Timer1_Tick
If logger Then LogColor("*************** Monitor Iniciado 👍🏽 **********", Colors.red)
@@ -55,6 +56,7 @@ End Sub
Sub Timer1_Tick
' Log("Next run " & DateTime.Time(DateTime.Now + Interval * 1000))
' Log("Monitor Timer_Tick")
If Starter.monitorActivo Then
DateTime.DateFormat = "dd/MM HH:mm:ss"
If B4XPages.IsInitialized Then B4XPages.MainPage.l_ultimoPing.Text = $"Último ping: ${DateTime.Date(DateTime.now)}"$