Reputation: 5393
I have a notification with couple of actions. I want to show it on wear, but without any action. How to do that?
builder.extend(new NotificationCompat.WearableExtender().addAction(null)); // Crashes
builder.extend(new NotificationCompat.WearableExtender().clearActions()); // Shows actions on Wear
Upvotes: 1
Views: 171
Reputation: 6635
As @Teyam said, this isn't directly possible. One workaround would be:
NotificationCompat.Builder.setLocalOnly()
.WearableListenerService
on the watch that generates a local notification there (with no actions) when a specific message is received.I recognize that this is quite a bit more work than simply extending your original notification. It's up to you to decide whether not having actions on the wearable is worth the effort.
Upvotes: 0
Reputation: 8082
Been looking for any functions to remove actions in wearables but found SO post 1 and SO post 2 which basically state that it's not possible to remove actions. It is, however, mentioned in Specify Wearable-only Actions that
If you want the actions available on the wearable to be different from those on the handheld, then use
WearableExtender.addAction()
. Once you add an action with this method, the wearable does not display any other actions added withNotificationCompat.Builder.addAction()
. That is, only the actions added withWearableExtender.addAction()
appear on the wearable and they do not appear on the handheld.
With that, you may opt to try setting an action which will appear only in wearable.
Hope that helps!
Upvotes: 1