I've been using DonManfred's Mobile Vision library for a while and not had any issues. However an application I have written has now been deployed to a client with 24 tablets the same as mine, Galaxy Tab A 8", they are reporting that the scanning function I created isn't working. Basically the users presses a scan button and a new Activity is created along with a form with a preview. I'm using CamEx2 to take the picture, which is working fine and then feeding the saved bitmap to MobileVision to extract the barcodes. On my tablet I have not had any issues.
Without giving all of the code, here's the steps in my activity relating to MobileVision.
1. On Globals - Dim barcode As BarcodeDetector
2. In Activity_Create - barcode.Initialize("Barcode")
3. Here's my TakePicture Sub
As I said I've never had an issue, but on the users tablets they are sometimes scanning, but most of the time it fails at the line checking if lBarcode.isOperational. Any clues of what it might be?
Thanks
Colin
Without giving all of the code, here's the steps in my activity relating to MobileVision.
1. On Globals - Dim barcode As BarcodeDetector
2. In Activity_Create - barcode.Initialize("Barcode")
3. Here's my TakePicture Sub
B4X:
Sub TakePicture
Try
SetState(openstate, True, False)
Wait For(cam.FocusAndTakePicture(MyTaskIndex)) Complete (Data() As Byte)
SetState(openstate, False, False)
'''
lstBarcodes.AddSingleLine("Picture File Length: "&Data.Length)
Dim bmp As Bitmap = cam.DataToBitmap(Data)
Dim lDateTime As String
Dim Out As OutputStream
lDateTime=GlobalFunctions.GetStampDateTime(DateTime.now).Replace(":","")
Try
Out = File.OpenOutput(File.Dirinternal, "PI-"&lDateTime&".jpg", False)
bmp.WriteToStream(Out, 50, "JPEG")
Out.Close
Catch
lstBarcodes.AddSingleLine("Error Saving File: "&LastException)
End Try
Dim l As String
Dim su As StringUtils
If File.Exists(File.Dirinternal,"PI-"&lDateTime&".jpg")=False Then
lstBarcodes.addsingleLine("File Wasn't Found: "&File.Dirinternal&"\PI-"&lDateTime&".jpg")
Else
l=su.EncodeBase64(GlobalFunctions.FileToBytes(File.Dirinternal, "PI-"&lDateTime&".jpg"))
If GlobalFunctions.gScan.ImageContent="" Then
GlobalFunctions.gScan.ImageContent=l
End If
End If
If barcode.isOperational Then
barcode.scanBitmap(bmp)
Else
lstBarcodes.addsingleLine("Barcode decoder is not showing as active")
End If
Log("Picture taken: " & bmp)
Catch
HandleError(LastException)
End Try
End Sub
As I said I've never had an issue, but on the users tablets they are sometimes scanning, but most of the time it fails at the line checking if lBarcode.isOperational. Any clues of what it might be?
Thanks
Colin