Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android Wear Specific Notification

The WearableNotifications.Builder setLocalOnly method can be used for displaying a notification on a phone only, and not mirror it to a Wear device.

Is there a way to do the opposite, so creating a notification that will display only on the Wear device?

like image 324
Steve Avatar asked Apr 23 '14 12:04

Steve


4 Answers

Actually you can do it using .setMinPriority() on the wearable notification (while it's not official, it works for now)

 Notification summaryNotification = new WearableNotifications.Builder(builderG)
        .setGroup(GROUP_KEY_MESSAGES, WearableNotifications.GROUP_ORDER_SUMMARY)
        .setMinPriority() 
        .build();
like image 118
Johnny505 Avatar answered Oct 18 '22 23:10

Johnny505


There is no way to specify an entire notification should not be displayed locally. However, the final notification extensions API (released 6/25), there is a way to specify actions which should only appear on a wearable.

To do this, add the actions wrapped in a WearableExtender:

NotificationCompat.Builder builder = new NotificationCompat.Builder();
builder.extend(new NotificationCompat.WearableExtender()
    .addAction(new NotificationCompat.Action(
        R.drawable.reply, "Reply", pendingIntent)));
like image 24
Mark Renouf Avatar answered Oct 18 '22 21:10

Mark Renouf


For the official SDK as per this question on Android Wear Developers Google+ page:

You can use the same notification APIs on the wearable that you use on a phone by writing an android wear app. If you need to trigger that notification from the phone, you can use the Wearable apis in Google Play Services to send messages to trigger them.

like image 2
Eliezer Avatar answered Oct 18 '22 21:10

Eliezer


There is a trick to add a notification for the wear device only.

Add the notification to a group with NotificationCompat.Builder.setGroup and don't display a summary notification for this group. The phone will only display the summary notifications, since there isn't one nothing is displayed on the phone. Just create a random group string for every notification that should only be displayed on the phone.

like image 1
Janusz Avatar answered Oct 18 '22 23:10

Janusz