Skip to content

Known Caveats

Sharing audio input in Android

There are known caveats related to audio capture on Android devices.

Android's microphone sharing behavior depends on the OS version and on the audio source used by each app.

Please refer to the Android platform guide for details:

Sharing audio input

Android 9 and earlier

Before Android 10, audio capture is generally first-come, first-served. While SORI SDK audio recognition is running, another ordinary app might fail to start microphone capture, or SORI SDK might fail to start if another app is already recording.

Privileged apps with system permissions, such as assistant or accessibility services, can be exceptions to this behavior.

Android 10 and later

Android 10 introduced a priority-based audio input sharing model. In this model, another app can start capturing audio while SORI SDK recognition is running. The lower-priority capture does not necessarily stop; it can continue running while receiving silence.

This is especially important when another app uses a privacy-sensitive audio source such as CAMCORDER or VOICE_COMMUNICATION. For example, if a camera app starts recording video while SORI SDK recognition is active, the camera app can receive microphone audio and SORI SDK can temporarily receive silence. When the higher-priority capture stops, Android can switch SORI SDK back to normal microphone input without restarting recognition.

In SORI SDK versions that use Android 10+ continuous capture, this transition is handled as part of normal capture behavior. Recognition results may be unavailable while SORI SDK is receiving silence, and recognition can resume after the higher-priority app releases the microphone. A short recovery window can occur before normal recognition resumes.

SORI SDK can continue to perform audio recognition even when the app is not displayed at the top of the screen by using a foreground service. In this case, the user may not be aware that audio recognition is still ongoing. It is recommended to provide a clear way to stop audio recognition.

About Recording Audio on iOS

Background Recognition

SORI SDK supports background recognition. Background recognition is also possible if you specify that the audio recorder can run in the background.

Background recognition can be used by adding the following keys and values in the project's Info.plist file. The code below is an example, where audio is the important part.

xml
<key>UIBackgroundModes</key>
<array>
    <string>fetch</string>
    <string>remote-notification</string>
    <string>audio</string>
</array>

TIP

Not all permissions are required, but having the above three permissions does not interfere with SORI SDK operation.

Side Effects of Using Background Recognition

SORI SDK acquires PCM data from the microphone using Apple Audio Queue System to hear the sound. To use the audio recorder without conflicting with the system or other apps, SORI SDK configures Audio Session(AVAudioSession) as follows.

  • Category: AVAudioSessionCategoryPlayAndRecord
  • Mode: AVAudioSessionModeMeasurement
  • Options: AVAudioSessionCategoryOptionMixWithOthers

In most situations, the above Audio Session configurations does not cause any problems. However, depending on the Audio Session configurations of a specific app, side effects may occur in rare cases in the operation of the SORI SDK or a specific app. In most cases, the side effect is that there is no sound through the speaker or earphones.