@Override
public void onNotificationPosted(int notificationId, Notification notification, boolean ongoing) {
if (ongoing) {
// Make sure the service will not get destroyed while playing media.
startForeground(notificationId, notification);
} else {
// Make notification cancellable.
stopForeground(false);
}
}