In my app I have three activities: Login, Selection and Produce. In Produce activity I use the barcode scanner with ABZxing library. In this case, if barcode isn't read in some seconds (readInterval), I return to Produce activity with this code:
Kiosk_Service module restart the Produce activity if it is paused:
I have a problem only if the barcode scanner is closed by Kiosk_Service, when I close Produce activity to return to Selection activity, the barcode scanner is resumed and Kiosk_Service doesn't work.
It is as if Android schedule the barcode scanner instead of my app when i want to return to Selection activity to Produce activity. What is the problem?
B4X:
Sub Activity_Pause (UserClosed As Boolean)
If Global.kiosk = True AND Global.currentActivity = "Produce" Then
If Global.flagBarcode = False Then
StartServiceAt(Kiosk_Service,DateTime.Now,False)
Else
StartServiceAt(Kiosk_Service,DateTime.Now + readInterval,False)
End If
End If
End Sub
Kiosk_Service module restart the Produce activity if it is paused:
B4X:
Sub Service_Start (StartingIntent As Intent)
Service.StartForeground(1, Notification)
KioskTimer.Enabled = True
End Sub
Sub Service_Destroy
KioskTimer.Enabled = False
Service.StopForeground(1)
End Sub
Sub KioskTimer_Tick
Global.flagBarcode = False
If IsPaused(Global.currentActivity) Then
StartActivity(Global.currentActivity)
End If
KioskTimer.Enabled = False
End Sub
I have a problem only if the barcode scanner is closed by Kiosk_Service, when I close Produce activity to return to Selection activity, the barcode scanner is resumed and Kiosk_Service doesn't work.
It is as if Android schedule the barcode scanner instead of my app when i want to return to Selection activity to Produce activity. What is the problem?