0

I use the linphone sdk and i want to get a list of audio devices, or rather their type and driverName, but it outputs in the style of {2: Audio, 3: Audio, 1: AAudio} Although if you do this on ios, it gives out normally in the style of {3: Speaker}

And here I would also like to do it on android

code:

val devices = core.audioDevices
val devicesMap: Map<Int, String> = devices.associateBy({ it.type.ordinal }, { it.driverName })
steind.VY
  • 333
  • 2
  • 11

1 Answers1

0

I do not know about linphone sdk but there is an Api in android named AudioDeviceInfo and it has methods that would satisfy you requirements.

    AudioManager audioManager = (AudioManager) getSystemService(Context.AUDIO_SERVICE);
        AudioDeviceInfo[] devices = audioManager.getDevices(AudioManager.GET_DEVICES_OUTPUTS);
        for (AudioDeviceInfo device : devices) {
            Log.d("Type",device.getType()); 
            Log.d("Product Name",device.getProductName());
            
        }
  • getType method will return an int value which associated with the type constant list of constants
  • getProductName() will return the human-readable name of the audio device in a CharSequence.
zaid khan
  • 825
  • 3
  • 11