Android Question SOLVED: Kiosk Mode B4A v12.80 (64bit) - Error: Unfortunately App has stopped

FrancescoS

Member
Licensed User
Longtime User
Hi everyone,
I am testing the original kiosk mode example.
I have compiled and run it on an android 4.4.4 tablet, first time works ok.
If I then press the button on the tablet that returns me to the desktop, when the Kiosk service tries to run the app again, I get the error:
"sorry - Unfortunately Kiosk App has stopped"
can anyone help me ? thanks.

B4A v 12.80
Android v4.4.4
Jdk 14.0.1
resources 11_22

log:
FATAL EXCEPTION: main
Process: anywheresoftware.b4a.kiosk, PID: 5243
java.lang.RuntimeException: Unable to create service anywheresoftware.b4a.kiosk.kioskservice: java.lang.RuntimeException: java.lang.RuntimeException: Cannot change properties after call to SetInfo. Initialize the notification again.
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2679)
at android.app.ActivityThread.access$2100(ActivityThread.java:141)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1330)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:136)
at android.app.ActivityThread.main(ActivityThread.java:5336)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:871)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:687)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot change properties after call to SetInfo. Initialize the notification again.
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:258)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:201)
at anywheresoftware.b4a.kiosk.kioskservice.onCreate(kioskservice.java:56)
at android.app.ActivityThread.handleCreateService(ActivityThread.java:2659)
... 10 more
Caused by: java.lang.RuntimeException: Cannot change properties after call to SetInfo. Initialize the notification again.
at anywheresoftware.b4a.objects.NotificationWrapper.getND(NotificationWrapper.java:92)
at anywheresoftware.b4a.objects.NotificationWrapper.setValue(NotificationWrapper.java:124)
at anywheresoftware.b4a.objects.NotificationWrapper.setSound(NotificationWrapper.java:109)


at anywheresoftware.b4a.kiosk.kioskservice._service_create(kioskservice.java:180)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:221)
... 13 more
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
Caused by: java.lang.RuntimeException: java.lang.RuntimeException: Cannot change properties after call to SetInfo. Initialize the notification again.
This is a simple one. Check the code that creates a notification. The call to Notification.SetInfo should be the last one (before showing it).
 
Upvote 0

FrancescoS

Member
Licensed User
Longtime User
Thanks Erel, SOLVED !

original code:

Original code in service:
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

corrected code:

corrected code:
Sub Service_Create
    pe.Initialize("pe")
    If Notification.IsInitialized = False Then
        Notification.Initialize
        Notification.Icon = "icon"
        Notification.Sound = False
        Notification.Vibrate = False
        Notification.SetInfo("Kiosk app", "Kiosk app", Main)
    End If
    Timer1.Initialize("Timer1", 300)
End Sub
 
Upvote 0
Top