<How to receive notifications every time a media s...
# stackoverflow
u
How to receive notifications every time a media session is opened/changed/closed in Android? How can I receive notifications in my app every time a media session is opened/changed/closed with the MediaSession API in Android and in other apps. In the logcat, I can see how these events are fired but I don't have any idea of how can I listen for them inside my app: ... D/vol.MediaSessions: onPlaybackStateChanged com.spotify.music STATE_PLAYING PlaybackState {state=3, position=421... ... D/vol.MediaSessions: onPlaybackStateChanged com.google.android.youtube STATE_PLAYING PlaybackState...