Hello Team,
I am trying to extend HMS lib with one more method. Scanning QR codes from a bitmap. Here is the github code and the official documentetion. I have been trying over 8 hours to figure out why my code returns null (as QR text result) even everything works fine.
Here is my code:
Thank you for your time.
I am trying to extend HMS lib with one more method. Scanning QR codes from a bitmap. Here is the github code and the official documentetion. I have been trying over 8 hours to figure out why my code returns null (as QR text result) even everything works fine.
Here is my code:
B4X:
Public Sub scanImage
Dim options As JavaObject
options.InitializeNewInstance("com.huawei.hms.ml.scan.HmsScanAnalyzerOptions$Creator", Null)
Dim HmsScanStatic As JavaObject
HmsScanStatic.InitializeStatic("com.huawei.hms.ml.scan.HmsScan")
Dim scanUtil As JavaObject
scanUtil.InitializeStatic("com.huawei.hms.hmsscankit.ScanUtil")
Dim itypes(Types.Size) As Int
For i = 0 To Types.Size - 1
itypes(i) = HmsScanStatic.GetField(Types.Get(i))
Next
options.RunMethod("setHmsScanTypes", Array(itypes.Length, itypes))
options.RunMethod("setPhotoMode",Array(False))
options = options.RunMethod("create", Null)
Log(Starter.Provider.GetFileUri("frame.png").As(String))
Private obj As JavaObject = scanUtil.RunMethod("decodeWithBitmap",Array(ctxt,scanUtil.RunMethod("compressBitmap",Array(ctxt,Starter.Provider.GetFileUri("frame.png").As(String))),options))
Private tmp As JavaObject
Log(tmp.InitializeNewInstance("com.huawei.hms.ml.scan.HmsScan",obj).RunMethod("getOriginalValue",Null))
End Sub
Thank you for your time.