androidForceEnableMediaButtons static method

Future<void> androidForceEnableMediaButtons()

In Android, forces media button events to be routed to your active media session.

This is necessary if you want to play TextToSpeech in the background and still respond to media button events. You should call it just before playing TextToSpeech.

This is not necessary if you are playing normal audio in the background such as music because this kind of "normal" audio playback will automatically qualify your app to receive media button events.

Implementation

static Future<void> androidForceEnableMediaButtons() async {
  await _platform.androidForceEnableMediaButtons(
    const AndroidForceEnableMediaButtonsRequest(),
  );
}