4

I am trying distinguish if a notification was opened from the watch or the phone. Currently I am trying to set the contentIntent for the notification builder which also appears on the watch as an "Open on phone" action. I want to be able to set a different intent just for the watch so that I can add other parameters to the intent, but I cannot find the right way to do it.

NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(context);
        notificationBuilder
                .setContentTitle(contentTitle)
                .setContentText(contentText)
                .setContentIntent(contentIntent)
                .extend(wearableExtender)

I've tried to add a wearable extender and the action for "Open on Phone" stopped working. I want to know if there is a way to disable the "Open on Phone" button for the wearables and still maintain a setContentIntent() for the phone notification? I've also tried setContentAction() on the extender and "Open on Phone" button, but it still doesn't work.

Any ideas on how to get this working?

seato
  • 2,061
  • 2
  • 15
  • 18
user3709877
  • 161
  • 11

1 Answers1

0

There is no known way to disable the primary action button when you set a PendingIntent to the notification.

According to the developer site for Android wear, the primary action 'Open on phone' button is automatically defined by setContentIntent(). So if you have PendingIntent associated with the notification on the handheld device, it is going to be automatically carried over to the wearable device with the default action button with same PendingIntent.

Val
  • 1