mirror of
https://github.com/ultrasonic/ultrasonic
synced 2025-02-16 19:50:35 +01:00
Add deleteIntent
This commit is contained in:
parent
d3b94f3d4c
commit
e4bf431cfe
@ -673,6 +673,7 @@ public class MediaPlayerService extends Service
|
|||||||
// Init
|
// Init
|
||||||
Context context = getApplicationContext();
|
Context context = getApplicationContext();
|
||||||
MusicDirectory.Entry song = (currentPlaying != null) ? currentPlaying.getSong() : null;
|
MusicDirectory.Entry song = (currentPlaying != null) ? currentPlaying.getSong() : null;
|
||||||
|
PendingIntent stopIntent = getPendingIntentForMediaAction(context, KeyEvent.KEYCODE_MEDIA_STOP, 100);
|
||||||
|
|
||||||
// We should use a single notification builder, otherwise the notification may not be updated
|
// We should use a single notification builder, otherwise the notification may not be updated
|
||||||
if (notificationBuilder == null) {
|
if (notificationBuilder == null) {
|
||||||
@ -690,6 +691,9 @@ public class MediaPlayerService extends Service
|
|||||||
|
|
||||||
// Add content intent (when user taps on notification)
|
// Add content intent (when user taps on notification)
|
||||||
notificationBuilder.setContentIntent(getPendingIntentForContent());
|
notificationBuilder.setContentIntent(getPendingIntentForContent());
|
||||||
|
|
||||||
|
// This intent is executed when the user closes the notification
|
||||||
|
notificationBuilder.setDeleteIntent(stopIntent);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use the Media Style, to enable native Android support for playback notification
|
// Use the Media Style, to enable native Android support for playback notification
|
||||||
|
Loading…
x
Reference in New Issue
Block a user