1. Download the #1 Android News App:   EarlyBird - News for Android
    Dismiss Notice

Android USB Communication

Last Updated:

  1. aldocampos

    aldocampos New Member

    I am new to android programming and I am trying to set a connection with the android as a host. I have included the following imports:
    import android.content.Context;
    import android.hardware.usb.UsbDevice;
    import android.hardware.usb.UsbManager;
    import android.hardware.usb.UsbInterface;
    import android.hardware.usb.UsbEndpoint;
    import android.hardware.usb.UsbDeviceConnection;
    import android.content.Context;

    My problem is when I use this code :m_usbManager = (UsbManager) getSystemService(Context.USB_SERVICE);
    The eclipse editor shows a message saying that getSystemService(String) is undefined for the type CPrinterCommands(The class that I am using). Quick fix gives as a solution to create a method called getSystemService, however I can

  2. myrecek

    myrecek Active Member

    getSystemService is a method in class Activity. Your CPrinterCommands class probably doesn't extend Activity so you have to pass an Activity object somehow into your class/method.

Share This Page