I am having issues with the 5.0 MediaSession controls. My app streams live music so I do not use a pause button, only a stop button. I cannot figure out how to only display a stop button on my wear device.....the stop button shows up and works fine from the Notification on my phone....but on Moto360 only displays the standard pause/play toggle. I can get the correct behavior from my watch when I override onPause(), but I want to use onStop() in the MediaSession callbacks. I do not want to confuse my users by showing the pause button.
private void buildNotification(Notification.Action action)
{
Notification.MediaStyle style = new Notification.MediaStyle();
style.setMediaSession(mSession.getSessionToken());
style.setShowActionsInCompactView(0);
Intent intent = new Intent(getApplicationContext(), Play.class);
intent.setAction(ACTION_STOP);
if ((selectedUrl.equals(MouseWorldRadioActivity.radioFiveIP)) || (selectedUrl.equals(MouseWorldRadioActivity.scrIP)))
{
PendingIntent pi = PendingIntent.getActivity(getApplicationContext(), 0,
new Intent(getApplicationContext(), nowPlaying.class),0);
Notification.Builder builder = new Notification.Builder(this)
.setSmallIcon(R.drawable.ic_stat_now_playing)
.addAction(action)
.setContentTitle("Mouseworld Radio")
.setContentText(metaData)
.setContentIntent(pi)
.setOngoing(true)
.setStyle(style);
lNotificationManager = (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);
lNotificationManager.notify(NOTIFICATION_ID, builder.build());
//build the notification with stop action---this is called in a different block
buildNotification(generateAction(R.drawable.ic_av_stop, "Stop", ACTION_STOP));