audio_session icon indicating copy to clipboard operation
audio_session copied to clipboard

Can't get current audio device

Open AlexMobile-l opened this issue 1 year ago • 1 comments

I'm trying to use the getCommunicationDevice() method, but I'm getting this exception: PlatformException(Error: java.lang.RuntimeException: Requires API level 31, null, null, null). The Android documentation says that it is supported starting from version 31, I am using version 33. What can I do in such a situation? There may be another method, but I haven't found it. Screenshot 2024-03-22 at 11 53 14

AlexMobile-l avatar Mar 22 '24 10:03 AlexMobile-l

This error refers to the version of Android that is installed on the user's device, not the target SDK level you have set in your build.gradle. If your minSdkVersion is 31, you should have no issue because users on older devices simply won't be allowed to install the app. But if your minSdkVersion is lower than 31 and some users have versions of Android above and below 31, you would need to write conditional code to check at runtime if the user's phone supports that feature or not depending on their API level.

ryanheise avatar Mar 22 '24 10:03 ryanheise