Cannot get connected MIDIInput devices in Android, SDK over 23


So I am writing an app that connects to an external MIDI drum pad in JUCE for Android and iOS. iOS MIDI communication is working fine with the device, but Android is not receiving MIDI signals in JUCE. In fact, the call to MidiInput::getDevices() returns an empty array. I have already explored similar issues, and my SDK is 23 and I am managing my own deviceManager, which I only add audioCallbacks to prior (I am not explicitly calling setMidiInputEnabled or MidiInput::openDevice(), nor do I have an AudioAppComponent or another class that has its own deviceManager). I have tested MIDI connectivity for Android using Android’s native midi Library, and that works fine. What can I be doing wrong in my JUCE application where the call to MidiInput::getDevices() is still not returning the connected MIDI device?

Have you tried running the MidiDemo example to check if the device shows up there?

I had the same issue. MidiDemo worked. Turns out it’s a timing issue. I was calling getAvailableDevices() in the constructor. MidiDemo calls it on a timer. (Not a problem on Windows or MacOS though).