Media with speakers are now supported by API 23. From docs, first make sure that the device has the required API and hardware
public boolean canPlayAudio(Context context) { PackageManager packageManager = context.getPackageManager(); AudioManager audioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE); // Check whether the device has a speaker. if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) { // Check FEATURE_AUDIO_OUTPUT to guard against false positives. if (!packageManager.hasSystemFeature(PackageManager.FEATURE_AUDIO_OUTPUT)) { return false; } AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS); for (AudioDeviceInfo device : devices) { if (device.getType() == AudioDeviceInfo.TYPE_BUILTIN_SPEAKER) { return true; } } } return false; }
If the above value returns true, you are set to play sounds on the wearable device, like on any other device, using MediaPlayer .
There is also an example application for more information.
source share