1

I am developing a media player for android. As from API 21 Google has deprecated the use of RemoteControlClient in favor of MediaStyle notifications and MediaController. But the new functionality hasn't been added to the support library. So if I want my app to be compatible with older OS versions, I have to do someting like this:

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLIPOP) {
  // Use MediaController
} else {
  // Use `RemoteControlClient`
}

Is there a cleaner way to accomplish this? The idea to support two different controller APIs is not so good (in my opinion).

Thanks in advance for any suggestions!

Kiril Aleksandrov
  • 2,601
  • 20
  • 27

1 Answers1

0

You can use the AppCompat Support Library Revision 22. It has new MediaSessionCompat & other support stuff.

For more details.

Check the links below:

Media Session Compat

Media Controller Compat

Akshay Chordiya
  • 4,761
  • 3
  • 40
  • 52