audio_service icon indicating copy to clipboard operation
audio_service copied to clipboard

Play button on A14 notification not working when targeting API 29

Open shadow5688 opened this issue 1 year ago • 3 comments

Documented behaviour

Music playback should start again when tapping the play button from the notification.

Actual behaviour

Nothing happens.

Runtime error

I don't see any error in the console.

Minimal reproduction project

Official example: main.dart

Reproduction steps

  1. Just change targetSdkVersion in gradle file to 29.
  2. Run on Android 14.
  3. Play anything and pause it.
  4. Try playing again from notification.

Output of flutter doctor

Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.16.8, on macOS 14.1.2 23B92 darwin-arm64,
    locale en-IN)
[!] Android toolchain - develop for Android devices (Android SDK version
    33.0.1)
    ✗ cmdline-tools component is missing
      Run `path/to/sdkmanager --install "cmdline-tools;latest"`
      See https://developer.android.com/studio/command-line for more
      details.
    ✗ Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/macos#android-setup
      for more details.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.86.2)
[✓] Connected device (4 available)
[✓] Network resources

! Doctor found issues in 1 category.```
### Devices exhibiting the bug
This happens only on Android 14

shadow5688 avatar Feb 25 '24 09:02 shadow5688

Just change targetSdkVersion in gradle file to 29.

Why would you target such an old version of Android? If you do that, you won't be allowed to submit your app to the Play Store. As of the 31st of August 2023, new apps must target SDK API level 33 or higher:

https://support.google.com/googleplay/android-developer/answer/11926878

ryanheise avatar Feb 25 '24 11:02 ryanheise

@ryanheise I’m experiencing the same issue. My target SDK is 34, but when I run the app on older devices (e.g. Samsung M31 running Android 31), I encounter the problem. Is there any known solution or workaround for running apps with a target SDK of 34 on older devices?

RomanSoviak avatar Sep 23 '24 16:09 RomanSoviak

@ryanheise I encountered the same issue. just use the example of audio_service, The problem is not about your target SDK version but rather the Android version of your device. My target SDK is 35, and my device is running Android 14. Can you please help to fix the issue?

yxspace avatar Jan 06 '25 17:01 yxspace