While everyone will work, I would suggest using the first approach. It doesn't look like MediaStyle NotificationCompat support will be added in the near future, based on the note in here that states:
Note. The template and addAction () method are not included in the support library, so these functions are only performed in Android 5.0 and higher.
In my case, I have a boolean that defines the API level:
boolean mIsLollipopOrAbove = Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP;
When the time comes to make a notification, I just check it and either use my own notification or create a MediaStyle notification based on the version of Android the user is running on. To support screen lock controls, I use the latest support libraries and interact with MediaSessionCompat, which will still use RemoteControlClient under the hood when required on pre-Lollipop devices. You can transfer the token for your MediaSessionCompat to a MediaStyle notification, which makes it easier to update the lock screen image based on the media being played.
source share