Home » Android » android – How to use MediaSessionCompat and keep backward compatibility with RemoteControlClient?

android – How to use MediaSessionCompat and keep backward compatibility with RemoteControlClient?

Posted by: admin June 15, 2020 Leave a comment

Questions:

I want to replace my android RemoteControlClient class in my application with a new one using MediaSession, but that not working with API level < 21, MediaSessionCompat seem to work without crashing old devices, but no more ARTWORK or song infos on the LockScreen is displayed…

Any snippet or infos for me ?

Thanks all!

How to&Answers:

As of revision 22 of the Support-v4 library, the source code for MediaSessionCompat shows that it now will automatically register and use a RemoteControlClient in API 14-20 devices before switching to MediaSession on API21+ devices.