Search code examples
androidandroid-notificationswear-osandroid-wear-notification

Android Notification on Wear device. `localOnly` flag


I have a few notifications running on my app built with NotificationCompat

Depending on the type, they show background bitmaps, or list of text, also most of them have 1 or 2 actions using the code:

builder.addAction(R.drawable.ic_notification, text, pendingIntent)

some of those actions makes sense for a watch (for example: "like" or "reply") and some doesn't (for example: "view album").

I thought I could use the setLocalOnly(boolean) method for it, but I found out that it is applied to the whole notification, not just to individual actions.

I've also been checking on NotificationCompat.Action and NotificationCompat.Action.WearableExtender but couldn't find anything that would be relevant.


So the question:

is there a way to make the notification show on the watch, but only with some of the actions but not others?


Solution

  • Please see docs in the paragraph "Specify wearable-only actions".