I'm trying out Android Things on my Raspberry Pi 3, and besides a little bit of a learning curve around the adb utility, things are going well. However, it doesn't seem like audio is working at all.
Ultimately I'm writing a small app using Google's Nearby API. This allows one Android device (my Pi) to talk to another over a short range. It does this over wifi and bluetooth. It also has an option to communicate over an extremely short range by using the speakers and microphone of the respective devices and sending near-ultrasonic sounds. I verified that the normal version (i.e. wifi/bluetooth) of Nearby is working correctly on my Pi. That is, I can publish a message from the Pi, and receive it on my phone. Again, that is working.
However, when I switch the publish strategy to "earshot," which uses the near-ultrasonic sounds, then my phone can no longer seem to see the signal coming from the Pi. So, I ran a test just to see if the audio was working at all, by adding a short bit of code to my app to play an MP3 file:
MediaPlayer mediaPlayer = MediaPlayer.create(this, R.raw.test_audio);
mediaPlayer.start();
But I don't hear anything. When I run the application in an Android emulator, the sound plays. But when I move it onto the Raspberry Pi, it won't play anything. This would explain why the ultrasonic signals from the Nearby API aren't working. I tested this using both the HDMI output and the 3.5 mm jack on the Pi and in both cases I could not hear any audio playing.
Does anyone know how to get audio working on a Raspberry Pi running Android Things?