Android Question Kiosk service prob

DPaul

Active Member
Licensed User
Longtime User
Hi,

Since a few days, my kiosk service that has been running to satisfaction for almost 2 years now, gives an error:
" java.lang.RuntimeException: Cannot change properties after call to SetInfo. Initialize the notification again."
Any ideas, i haven't touched it for ages. It's run off the mill, that i found on this forum.
thx
Paul
B4X:
#Region Module Attributes
#StartAtBoot: True
#End Region

'Service module
Sub Process_Globals
    Dim Notification As Notification
    Dim Timer1 As Timer
    Private pe As PhoneEvents
    Private screenOff As Boolean = False
End Sub
Sub Service_Create
    pe.Initialize("pe")
    If Notification.IsInitialized = False Then
        Notification.Initialize
        Notification.Icon = "icon"
        Notification.SetInfo("Kiosk app", "Kiosk app", Main)
        Notification.Sound = False
        Notification.Vibrate = False
    End If
    Timer1.Initialize("Timer1", 300)
End Sub

Sub Service_Start (StartingIntent As Intent)
    Service.StartForeground(1, Notification)
    If IsPaused(Main) Then Timer1.Enabled = True
End Sub

Sub Service_Destroy
    Service.StopForeground(1)
    Timer1.Enabled = False
End Sub
Sub Timer1_Tick
    If screenOff Then
        Timer1.Enabled = False
    End If
    If IsPaused(Main) Then
        StartActivity(Main)
    Else
        Timer1.Enabled = False
    End If
End Sub
Sub pe_ScreenOff (Intent As Intent)
    Timer1.Enabled = False
    screenOff = True
End Sub
Sub pe_ScreenOn (Intent As Intent)
    Timer1.Enabled = True
    screenOff = False
End Sub
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

DPaul

Active Member
Licensed User
Longtime User
Hi,

I am indeed using the latest version.
From what i understand:
i moved "Notification.SetInfo("Kiosk app", "Kiosk app", Main)", 2 lines down, and it seems to do the trick as the last notification statement...
Thanks,
paul
 
Upvote 0
Top