diff --git a/patches/react-native-track-player+4.0.1.patch b/patches/react-native-track-player+4.0.1.patch new file mode 100644 index 0000000..aaf8332 --- /dev/null +++ b/patches/react-native-track-player+4.0.1.patch @@ -0,0 +1,25 @@ +diff --git a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt +index 9d6d869..cb49aa6 100644 +--- a/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt ++++ b/node_modules/react-native-track-player/android/src/main/java/com/doublesymmetry/trackplayer/service/MusicService.kt +@@ -120,9 +120,17 @@ class MusicService : HeadlessJsTaskService() { + notificationBuilder.foregroundServiceBehavior = NotificationCompat.FOREGROUND_SERVICE_IMMEDIATE + } + val notification = notificationBuilder.build() +- startForeground(EMPTY_NOTIFICATION_ID, notification) +- @Suppress("DEPRECATION") +- stopForeground(true) ++ try { ++ // reference exception catch of startForegroundIfNecessary function ++ startForeground(EMPTY_NOTIFICATION_ID, notification) ++ @Suppress("DEPRECATION") ++ stopForeground(true) ++ } catch (error: Exception) { ++ Timber.e( ++ "ForegroundServiceStartNotAllowedException: App tried to start a foreground Service when it was not allowed to do so.", ++ error ++ ) ++ } + } + + @MainThread