EDIT - FOUND A EASY 5-10 LINE SOLUTION!!! See MY OWN ANSWER BELOW!!! YAY!!!!!!!!!
I\'ve searched for 5 hours, dozens of SO posts, no answers, and this seems like t
For those still looking for a solution in lollipop or just without using permission thing, I came up with another solution as last resource. We can measure the time user has been afk. If it was more than X ms, then you can consider he left the application and stop the music.
So I'm using Application child where I store the time afk and BaseActivity to override onPause and onResume of all my activities.