Beginning with the Android 6.0 (Marshmallow) release, device makers can enable optional MIDI support in the platform.
If your device manufacturer added support for the USB peripheral mode, please follow these steps to enable it and make your device appear as a MIDI device via the USB cable connection, which TouchOSC can then use to send and receive MIDI messages.
While attached to a USB host, pull down from the top of screen and select the entry USB for ... or similiar. The exact wording will depend on the customizations applied by your device manufacturer.
From the list of options that appear, select MIDI or similar. Again, the exact wording will depend on the customizations applied by your device manufacturer.
Alternatively these options can also be found in the Android Developer Options at Settings > Developer options > Networking > Select USB Configuration.
By enabling the USB peripheral mode on your Android device, the OS will also create MIDI input and output ports that TouchOSC can use to send and receive MIDI messages via the USB cable connection.
In TouchOSC's MIDI connection configuration select the newly created Android USB Peripheral Port (or similar) for both the Send Port and Receive Port fields.
Sadly, again, the exact naming of these ports will depend on the customizations applied by your device manufacturer.
We'll use the Protokol application to confirm that the MIDI ports are visible to our USB host and that we can receive MIDI messages sent from TouchOSC.
Protokol is our free tool for testing OSC and MIDI connections and messages. This is the same utility we use in-house for testing our applications.
Launch the Protokol application, switch to the MIDI tab page, and check the checkbox next to Enabled
If all went well, you should see a connected MIDI endpoint in Protokol that is named similarly to your device, and MIDI messages sent from TouchOSC via the USB connection should be received by Protokol.
As you might have guessed, the exact names of the MIDI ports that your device creates depend on the customizations applied by your device manufacturer.