And I ran into this error while compiling using the same code as the tutorial provides:
error: incompatible types: UsbAccessoryWrapper cannot be converted to UsbAccessory
if (anywheresoftware.b4a.keywords.Common.Not(_v6.HasAccessoryPermission((android.hardware.usb.UsbAccessory)(_v7)))) {
Does anyone know if there is a fix to this or is something else wrong?
Sub BtnConnect_Click
Dim Accs() As UsbAccessory
USBman.Initialize
Accs = USBman.GetAccessories
If Accs.Length > 0 Then
ADK = Accs(0)
If Not(USBman.HasAccessoryPermission(ADK)) Then
USBman.RequestAccessoryPermission(ADK)
Else
USBman.OpenAccessory(ADK)
AStream.Initialize(ADK.InputStream, ADK.OutputStream, "AStream")
BtnConnect.Enabled = False
ConnectEnabled = False
End If
End If
End Sub
B4X:
If Not(USBman.HasAccessoryPermission(ADK)) Then
USBman.RequestAccessoryPermission(ADK)
These two lines create the error. I ran this once already and it worked. When I tried to compile it a second time it started giving me the error.