I've been scouring the internet on this and can't quite find a solution. I want to use a hardware button accessory (bluetooth, nfc, or even simple 1/8th-inch mic jack) to do the equivalent of pressing the "microphone icon" on GBoard and start voice dictation.
That is, assume we are in an app with a text input field highlighted. The user would press the hardware button and GBoard would start listening for dictation as if the user had tapped on the microphone icon.
Any ideas? There are plenty of button solutions out there, including Android's built-in accessibility switch functionality but I can't come up with a way to map the button press specifically to the "start voice recognition" software button.