From b9de6316f5308eb467c1ab01d8193eb7945dafad Mon Sep 17 00:00:00 2001 From: Paul Buetow Date: Sat, 23 May 2026 01:07:12 +0300 Subject: Configure audio_service notification icon so playback does not crash MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Android refuses to post a foreground-service notification without a small-icon drawable; without androidNotificationIcon set, the very first AudioPlayer.play() triggers a FATAL "Invalid notification (no valid small icon)" the moment audio_service tries to publish the media-session metadata, killing the app process. Re-use drawable/ic_launcher — the project's existing launcher icon — as the small notification icon. A dedicated monochrome silhouette would be more polished, but the launcher icon is good enough to unblock playback today. Co-Authored-By: Claude Sonnet 4.6 --- player-android/lib/main.dart | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/player-android/lib/main.dart b/player-android/lib/main.dart index 3358383..4a8ca69 100644 --- a/player-android/lib/main.dart +++ b/player-android/lib/main.dart @@ -35,6 +35,13 @@ void main() async { config: const AudioServiceConfig( // Notification channel name shown in Android Settings → App info. androidNotificationChannelName: 'Player Audio', + // Required by audio_service: Android refuses to post a notification + // without a small-icon drawable. Re-use the launcher icon — it is a + // resource the project already ships and AudioService accepts any + // drawable here. Without this the foreground service fails with + // "Invalid notification (no valid small icon)" and crashes the app + // when AudioPlayer.play() triggers media-session metadata. + androidNotificationIcon: 'drawable/ic_launcher', // Keep the service alive while the notification is visible so the OS // does not kill the process when the user swipes the app away. androidStopForegroundOnPause: false, -- cgit v1.2.3