Android Question Error opening USB

Discussion in 'Android Questions' started by akosije, Jan 29, 2015.

  1. akosije

    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 **


    Code:
    If usb.UsbPresent = usb.open(9600Then       
            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.
     

    Attached Files:

  2. Erel

    Erel Administrator Staff Member Licensed User

  3. akosije

    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
     
  4. akosije

    akosije Member Licensed User

    Its working now!!

    I just Downloaded the usb serial v2.4 and it works fine!!
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice