Here is the patch with the following fix compared to previous version: + return AUDIOTRACK_SESSION_ID without testing sdk version, as it should be 0 when not available. + don't rely on MediaSession.setActive to be immediate + fix exception on devices with sdk < 21 I've tested it from Android 4.0.4 to Android 8.