I'm following the steps to use ADK to control mbed via the Android Studio
however their mbed adkport code (Scroll down to adkport hyperlink) requires these imports
import com.android.future.usb.UsbAccessory;
import com.android.future.usb.UsbManager;
I've noticed another thread that suggested the developer's solution was to switch it to android.hardware.usb, but when I do that, 3 different lines won't work because the hardware based package doesn't support getAccessory and getInstance symbols
Any solutions to this problem? Can't get my head around it
I tried following the steps for replacing the code to use android.hardware.usb instead but I still get an issue with their own android developer routine
//mManager = UsbManager.getInstance(context);
UsbManager mManager = (UsbManager) getSystemService(Context.USB_SERVICE);
however now it doesn't recognize getSystemService
Here's where it fails.
public void setup(Context context)
{
//mManager = UsbManager.getInstance(context);
UsbManager mManager = (UsbManager) getSystemService(Context.USB_SERVICE); //<-----
UsbAccessory[] accessoryList = mManager.getAccessoryList();
PendingIntent mPermissionIntent = PendingIntent.getBroadcast(context, 0,
new Intent(ACTION_USB_PERMISSION), 0);
IntentFilter filter = new IntentFilter(ACTION_USB_PERMISSION);
context.registerReceiver(mUsbReceiver, filter);
mManager.requestPermission(accessoryList[0], mPermissionIntent);
if (accessoryList[0] != null) {
mAccessory = accessoryList[0];
if(mManager.hasPermission(mAccessory))
{
openAccessory(mAccessory);
}
}
}