Hi all
I have a handheld device with a built in barcode scanner.
It seems to work just fine for a few hours and then starts failing to scan; it is almost as if the service intent is not starting?
Below is the service code:
Here is the Manifest additions:
As said, the BarcodeScanned sub is called as expected for quite a while before it stops working, no errors or anything.
The first thing the BarcodeScanned sub does is makes an audible beep which we don't hear so I am guessing the service does not get invoked at all...
Even more odd is rebooting the device does not always fix it straight away, it can take several reboots and even a battery removal to get the thing back into life.
Is there a problem starting the same service via intents multiple times? Am I stopping it correctly? Anyone got any ideas?
Thanks
I have a handheld device with a built in barcode scanner.
It seems to work just fine for a few hours and then starts failing to scan; it is almost as if the service intent is not starting?
Below is the service code:
B4X:
#Region Service Attributes
#StartAtBoot: False
#End Region
Sub Process_Globals
End Sub
Sub Service_Create
End Sub
Sub Service_Start (StartingIntent As Intent)
If StartingIntent.HasExtra("barcode_string") Then
' see if we have a code
Dim sCode As String = StartingIntent.GetExtra("barcode_string")
' pass back to stock movement activity
CallSubDelayed2(MoveStock, "BarcodeScanned", sCode)
End If
Service.StopAutomaticForeground
End Sub
Sub Service_Destroy
End Sub
Here is the Manifest additions:
B4X:
AddReceiverText(CodeScanned,
<intent-filter>
<action android:name="android.intent.ACTION_DECODE_DATA" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>)
As said, the BarcodeScanned sub is called as expected for quite a while before it stops working, no errors or anything.
The first thing the BarcodeScanned sub does is makes an audible beep which we don't hear so I am guessing the service does not get invoked at all...
Even more odd is rebooting the device does not always fix it straight away, it can take several reboots and even a battery removal to get the thing back into life.
Is there a problem starting the same service via intents multiple times? Am I stopping it correctly? Anyone got any ideas?
Thanks