I am building a music player like Spotify and want to save the last played song when the user clears the app from the "recents list" and as onDestory()
is not guaranteed to run when the app is cleared from the recent list and Background service only runs for a minute in API level > 26. So, to me using a Foreground service seems the best possible way to do some chores when the app is cleared from the recent list. And, showing a new notification while the ExoPlayerNotification is shown in the notification area would seem odd. So, is there any way to attach a Foreground service with the ExoPlayerNotification so that I would be notified about the app getting removed in onTaskRemoved(). Please feel free to suggest if there are any better ways to achieve the same.
PS Not talking about what I tried as I already did in this question here