TL;DR: Use android.support.v4.app notification mechanism. Steps are:
Create a WearableExtender:
NotificationCompat.WearableExtender wearableExtender = new NotificationCompat.WearableExtender() .setHintShowBackgroundOnly(true) .setHintHideIcon(true) .setContentIcon(R.mipmap.ic_launcher);
Extend the notification mechanism:
NotificationCompat.Builder mBuilder = new NotificationCompat.Builder(this) .setContentTitle(title) .setStyle(new NotificationCompat.BigTextStyle().bigText(msg)) .setContentText(msg) .setSmallIcon(R.drawable.ic_stat_e) .setLargeIcon(BitmapFactory.decodeResource(getResources(), R.mipmap.ic_launcher)) .extend(wearableExtender);
Trigger the notification:
After reading various sources, I got my application to send notification to my watch using the code above. At the beginning, I thought the notifications weren’t sent. I thought I needed to enable wear in the manifest (which I did), but… notifications were sent, just the watch was on charging dock and was’t doing anything :(.
To make sure things were OK, I’ve enabled vibration:
Notification notification = mBuilder.build(); notification.defaults |= Notification.DEFAULT_VIBRATE; NotificationManagerCompat.from(this).notify(NOTIFICATION_ID, notification);
Now the watch (and the phone) vibrate when the notification is triggered! Cool!
PS: Never mind the amazon underground swatch :)