Whatsapp like notification in android wear -
i need achieve notification in android wear in whatsapp each conversation list , sliding right allows user reply respective conversation. tried stacking android developers example displays messages is. how set more 1 message , respective action in whatsapp?
edit:
notificationcompat.wearableextender wearoptions = new notificationcompat.wearableextender() .sethinthideicon(true); string replylabel = mxmppconnectionservice.getresources().getstring(r.string.wear_reply); remoteinput remoteinput = new remoteinput.builder(extra_voice_reply) .setlabel(replylabel) .build(); intent replyintent = new intent(mxmppconnectionservice, xmppconnectionservice.class); pendingintent replypendingintent = pendingintent.getactivity(mxmppconnectionservice, 0, replyintent, pendingintent.flag_update_current); notificationcompat.action action = new notificationcompat.action.builder(r.mipmap.ic_launcher, "reply to", replypendingintent) .addremoteinput(remoteinput) .build(); final builder mbuilder; mbuilder.setdefaults(0); mbuilder.setsmallicon(r.drawable.ic_notification); mbuilder.setpriority(getpriority()); mbuilder.setdeleteintent(createdeleteintent()); mbuilder.setlights(0xff00ff00, 2000, 3000) .extend(wearoptions) .extend(new notificationcompat.wearableextender().addaction(action)); final notification notification = mbuilder.build(); notificationmanager.notify(notification_id, notification);
you missing 3 different things:
- you not calling
setgroup("grop_name")
onnotificationbuilder
- notifications belong same group must have different ids. if notify same id,
notification_id
in case, ste stacking not work - you want different
replypendingintent
each notification, otherwise pending intent refer last notification notified. instead of hard-coding0
, pass different value each notification.
the rest looks good,
Comments
Post a Comment