I am creating a micro application for wearing. Now I work with notifications on the device.
Here is my sample code:
NotificationCompat.Builder builder = new NotificationCompat.Builder(context) .setContentTitle(title) .setContentText(message) .setSmallIcon(icon) .setGroup(groupKey); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(context); notificationManager.notify(id, builder.build());
This notification is never displayed, and it does not matter if I have one or more notifications with the same group key. Do you know what I am doing wrong?
Just for clarification, I divided my activity into this:
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationManagerCompat notificationManager = NotificationManagerCompat.from(this); NotificationCompat.Builder builder = new NotificationCompat.Builder(this) .setContentTitle("title") .setContentText("message") .setSmallIcon(R.drawable.ic_launcher) .setGroup("groupKey"); notificationManager.notify(111, builder.build()); builder = new NotificationCompat.Builder(this) .setContentTitle("title2") .setContentText("message2") .setSmallIcon(R.drawable.ic_launcher) .setGroup("groupKey"); notificationManager.notify(222, builder.build()); }
If these .setGroup("groupKey") lines are inside the downloadable application (on wearable media), no notifications are visible. If I delete them, notifications will be visible (ungrouped for a reason). This does not work for me on Samsung Gear Live (Android 4.4W.1) and emulator (Android 4.4W).
source share