Hide the open on phone action on wearable

How can I supress the "open on phone" action on a wearable? I added a more helpful custom action which is now a dublicate action. Any idea how I can remove it?

Here is a snip it how I build the Notification:

NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
    .setContentTitle("Title")
    .setContentText("Message")
    .setSmallIcon(R.drawable.icon)
    .setContentIntent(openIntent);
NotificationCompat.WearableExtender extender =
                   new NotificationCompat.WearableExtender();
extender.addAction(new NotificationCompat.Action.Builder(icon, "do something",
                   openIntent).build());
builder.extend(extender);

I know that I can create a second notification which is only visible on the wearable but that cannot be wanted by android that I need to create a seperate notification isn't it?


According to the documentation the "Open on phone" action is added automatically when you have any PendingIntent set in setContentIntent(PendingIntent intent) method.

When this notification appears on a handheld device, the user can invoke the PendingIntent specified by the setContentIntent() method by touching the notification. When this notification appears on an Android wearable, the user can swipe the notification to the left to reveal the Open action, which invokes the intent on the handheld device.


I don't think you can "disable" this action (apart from just not specifying the contentIntent, but I guess that this is not a solution for you).

I'm not familiar with your exact situation, but mostly people set contentIntent on a notification to launch some Activity that shows details or to allow user to do some more things (like input, configuration etc). In that case I don't see a need to try to disable this extra action even if you are serving some kind of "lightweight" solution right on your Android Wear device.

But if you really want to get rid of this "Open on phone" action (while still having the contentIntent set on phone) you will need to have separate notification published from the Android Wear device.

You will need to use DataApi to sync your notification state. See more details about DataApi in the documentation:
https://developer.android.com/training/wearables/data-layer/index.html https://developer.android.com/training/wearables/data-layer/data-items.html

Also you can check an example of usage of DataApi in one of my answers.


This answer seems to be out of date for Wear OS 2.x. I'm trying to update this answer as soon I can.

I ended in creating multiple notifications. Here is an example:

// for the wearable
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
    .setContentTitle("Title")
    .setContentText("Message")
    .setSmallIcon(R.drawable.icon)
    .setContentIntent(openIntent)
    .setGroup("MyGroup")
    .setDeleteIntent(magic());
    // since I don't set setGroupSummary(true) this
    // notification will not been display on a mobile
NotificationCompat.WearableExtender extender =
                   new NotificationCompat.WearableExtender();
extender.addAction(new NotificationCompat.Action.Builder(icon, "do something",
                   openIntent).build());
builder.extend(extender);
// fire it

// for the mobile
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
    .setContentTitle("Title")
    .setContentText("Message")
    .setSmallIcon(R.drawable.icon)
    .setContentIntent(openIntent)
    .setLocalOnly(true) // the magic to hide it on the wearable
    .setDeleteIntent(magic());
// fire it

With magic() I create a PendingIntent which invokes a BroadcastReciever which hides the other notifications to keep them in sync.