Android Question Error opening USB

akosije

Member
Licensed User
Error:
** Activity (main) Pause, UserClosed = false **
** Activity (main) Resume **
Installing file.
** Activity (main) Pause, UserClosed = false **
PackageAdded: package:b4a.example1
** Activity (main) Create, isFirst = true **
Error opening USB port
(Exception) Not initialized
** Activity (main) Resume **


B4X:
If usb.UsbPresent = usb.open(9600) Then       
        ast.Initialize(Me, "ast", usb.GetInputStream, usb.GetOutputStream)
        Log(ast)
        Else
        Log("Error opening USB port")
        'Log(LastException)
        End If
That code works on my attached file but i dont know why this code isnt work on my other project.
 

Attachments

akosije

Member
Licensed User
Hi sir Erel,

I already inlucde this on my xml file

AddActivityText(main, <intent-filter>
<action android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED" />
</intent-filter>
<meta-data android:name="android.hardware.usb.action.USB_DEVICE_ATTACHED"
android:resource="@xml/device_filter" />)

and put the device_filter on res/xml

but still same error
 
Top