diff options
author | H. Lehmann <ByteHamster@users.noreply.github.com> | 2019-09-03 19:14:52 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-09-03 19:14:52 +0200 |
commit | cbaf8818bf3e7c9af59937927d3e7e05fa7aec16 (patch) | |
tree | 29be156174c8085c50e1954aa729903ce8a84720 /core/src/main/java | |
parent | 0ae092be3af1b42720c952c3de5571cf1e60a204 (diff) | |
parent | 5825b7645b49d0d06324d6c75ade3474dbf9c71c (diff) | |
download | AntennaPod-cbaf8818bf3e7c9af59937927d3e7e05fa7aec16.zip |
Merge pull request #3371 from ByteHamster/notification-action-foreground
Executing notification actions in foreground
Diffstat (limited to 'core/src/main/java')
-rw-r--r-- | core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java index 9a1e8e7ef..564d1d022 100644 --- a/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java +++ b/core/src/main/java/de/danoeh/antennapod/core/service/playback/PlaybackServiceNotificationBuilder.java @@ -5,6 +5,7 @@ import android.content.Context; import android.content.Intent; import android.graphics.Bitmap; import android.graphics.BitmapFactory; +import android.os.Build; import android.support.annotation.NonNull; import android.support.v4.app.NotificationCompat; import android.support.v4.media.session.MediaSessionCompat; @@ -178,7 +179,11 @@ public class PlaybackServiceNotificationBuilder extends NotificationCompat.Build private PendingIntent getPendingIntentForMediaAction(int keycodeValue, int requestCode) { Intent intent = new Intent(context, PlaybackService.class); intent.putExtra(MediaButtonReceiver.EXTRA_KEYCODE, keycodeValue); - return PendingIntent .getService(context, requestCode, - intent, PendingIntent.FLAG_UPDATE_CURRENT); + + if (Build.VERSION.SDK_INT >= 26) { + return PendingIntent.getForegroundService(context, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT); + } else { + return PendingIntent.getService(context, requestCode, intent, PendingIntent.FLAG_UPDATE_CURRENT); + } } }
\ No newline at end of file |