Search code examples
androidflutteraudio

How to Get Specific Android Documentation Answers


I'm using audio_session to configure my app like this:

  final session = await AudioSession.instance;
  await session.configure(const AudioSessionConfiguration(
    avAudioSessionCategory: AVAudioSessionCategory.playAndRecord,
    avAudioSessionCategoryOptions: AVAudioSessionCategoryOptions.mixWithOthers,
    avAudioSessionMode: AVAudioSessionMode.measurement,
    avAudioSessionSetActiveOptions: AVAudioSessionSetActiveOptions.none,
    androidAudioAttributes: AndroidAudioAttributes(
      contentType: AndroidAudioContentType.sonification,
      flags: AndroidAudioFlags.none,
      usage: AndroidAudioUsage.alarm,
    ),
    androidAudioFocusGainType: AndroidAudioFocusGainType.gainTransient,
    androidWillPauseWhenDucked: true,
  ));

In getting answers on iOS settings, it was very easy to get descriptions from the docs.

I do not, however, understand how to get explations of enum and const values for Android. For instance:

androidAudioFocusGainType: AndroidAudioFocusGainType.gainTransient,

all options: gain, gainTransient, gainTransientExclusive, gainTransientMayDuck.

What do these mean and do? Android docs for AndroidAudioFocusGainType do not provide any explanation (making it very hard for audio_session to do any better).

Is this an Android failing, and I have to get used to it, or is there a source of information I'm not aware of?


Solution

  • Android docs for AndroidAudioFocusGainType do not provide any explanation (making it very hard for audio_session to do any better)

    That is not Android SDK documentation. Off the cuff, it appears to be Flutter documentation.

    Is this an Android failing, and I have to get used to it

    The Android SDK appears to have documentation for the constants that map to those Flutter values, such as AUDIOFOCUS_GAIN_TRANSIENT_EXCLUSIVE.