Android Question (solved, with 1 question) Intent for connected USB-keyboard

Discussion in 'Android Questions' started by Filippo, May 15, 2015.

  1. Filippo

    Filippo Expert Licensed User

    Hi all,

    Is there an intent-filter that tells me if a USB-keyboard is connected?

    I found this, but does not say that it is a USB keyboard.
    Code:
    "android.hardware.usb.action.USB_DEVICE_ATTACHED"
     
    Last edited: May 16, 2015
  2. Filippo

    Filippo Expert Licensed User

    Now I know how to do that.
    For me, it's enough!
    Code:
    If StartingIntent.Action="android.hardware.usb.action.USB_DEVICE_ATTACHED" Then
            
    ToastMessageShow("USB_DEVICE_ATTACHED:" & StartingIntent.GetExtra("mManufacturerName"), True)
        
    Else If StartingIntent.Action="android.hardware.usb.action.USB_DEVICE_DETACHED" Then
            
    ToastMessageShow("USB_DEVICE_DETACHED:" & StartingIntent.GetExtra("mManufacturerName"), True)
        
    End If
     
    Syd Wright likes this.
  3. Filippo

    Filippo Expert Licensed User

    Code:
    Log("USB_DEVICE_DETACHED:" & StartingIntent.ExtrasToString))
    The line shows approximately:
    and this line
    Code:
    Log(StartingIntent.GetExtra("mManufacturerName")) -> null
    How can I get the "mManufacturerName" ?
     
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