diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java | 6 | ||||
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java | 4 |
2 files changed, 9 insertions, 1 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java index e91e24ec6..08bdd39bc 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java +++ b/core/src/main/java/de/danoeh/antennapod/core/receiver/MediaButtonReceiver.java @@ -37,7 +37,11 @@ public class MediaButtonReceiver extends BroadcastReceiver { serviceIntent.putExtra(EXTRA_KEYCODE, event.getKeyCode()); serviceIntent.putExtra(EXTRA_SOURCE, event.getSource()); serviceIntent.putExtra(EXTRA_HARDWAREBUTTON, event.getEventTime() > 0 || event.getDownTime() > 0); - ContextCompat.startForegroundService(context, serviceIntent); + try { + ContextCompat.startForegroundService(context, serviceIntent); + } catch (Exception e) { + e.printStackTrace(); + } } } diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java index 4f352aa15..92119e31e 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackService.java @@ -1460,6 +1460,10 @@ public class PlaybackService extends MediaBrowserServiceCompat { } if (transientPause) { transientPause = false; + if (Build.VERSION.SDK_INT >= 31) { + stateManager.stopService(); + return; + } if (!bluetooth && UserPreferences.isUnpauseOnHeadsetReconnect()) { mediaPlayer.resume(); } else if (bluetooth && UserPreferences.isUnpauseOnBluetoothReconnect()) { |