I build a micro app for a wearable now I'm working with notifications on the device.
Here is my example 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 shown and it does not matter if I have one or multiple notifications with the same group key. Do you know what I'm doing wrong?
Just for clarification I striped down my Activity to 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 those .setGroup("groupKey")
lines are inside the wearable app (on the wearable) no notifications are visible. If I remove them the notifications are visible (ungrouped of cause). That does not work for me on the Samsung Gear Live (Android 4.4W.1) and the emulator (Android 4.4W).