Skip to content

Conversation

alexlapa
Copy link

@alexlapa alexlapa commented Oct 7, 2025

Synopsis

There are new AudioManager APIs since SDK 31 (availabaleCommunicationDevices, setCommunicationDevice, clearCommunicationDevice, onCommunicationDeviceChanged).

Solution

Use new AudioManager APIs when available.

Some important notes:

  1. Users can no longer rely on hardcoded device IDs to determine audio output device kind but must inspect new AudioDeviceKind enum.
  2. If new API is used it will not remove ear-piece device when there is a wired headset available but just return everything AudioManager.availableCommunicationDevices returns
  3. There might be multiple wired or bluetooth headsets availble (again, just returning whatever system reports)

Checklist

  • Created PR:
    • In draft mode
    • Name contains issue reference
    • Has type and k:: labels applied
    • Has assignee
  • Before review:
    • Documentation is updated (if required)
    • Tests are updated (if required)
    • Changes conform code style
    • CHANGELOG entry is added (if required)
    • FCM (final commit message) is posted or updated
    • Draft mode is removed
  • Review is completed and changes are approved
    • FCM (final commit message) is approved
  • Before merge:
    • Milestone is set
    • PR's name and description are correct and up-to-date
    • All temporary labels are removed

# Conflicts:
#	CHANGELOG.md
# Conflicts:
#	CHANGELOG.md
#	android/src/main/kotlin/com/instrumentisto/medea_flutter_webrtc/controller/RtpSenderController.kt
#	android/src/main/kotlin/com/instrumentisto/medea_flutter_webrtc/media/AudioFocusCompat.kt
#	android/src/main/kotlin/com/instrumentisto/medea_flutter_webrtc/media/MediaDevices.kt
@alexlapa alexlapa self-assigned this Oct 7, 2025
@alexlapa alexlapa added k::refactor Refactoring, technical debt elimination and other improvements of existing code base k::design Applies to changes of application architecture and implementation design plarform::android Specific to Android platform labels Oct 7, 2025
@alexlapa
Copy link
Author

alexlapa commented Oct 8, 2025

FCM:

Use `AudioManager` communication devices API on Android >= 31 (#257)

@alexlapa alexlapa marked this pull request as ready for review October 9, 2025 07:20
@alexlapa alexlapa requested a review from tyranron October 9, 2025 07:20
@tyranron tyranron added the enhancement Improvement of existing features or bugfix label Oct 9, 2025
@tyranron tyranron enabled auto-merge (squash) October 9, 2025 14:05
@tyranron tyranron disabled auto-merge October 9, 2025 20:18
@tyranron tyranron merged commit 77af4f2 into main Oct 9, 2025
23 of 27 checks passed
@tyranron tyranron deleted the enumerate-audio-devices-new-apis branch October 9, 2025 20:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Improvement of existing features or bugfix k::design Applies to changes of application architecture and implementation design k::refactor Refactoring, technical debt elimination and other improvements of existing code base plarform::android Specific to Android platform

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants