How to utilize Android Nougat's Direct Reply feature with a NotificationListener?

前端 未结 1 1571
忘了有多久
忘了有多久 2021-02-12 22:31

My app is using a NotificationListener to read out messages from various 3rd party apps, for example WhatsApp.

So far I was able to send a reply if only one

相关标签:
1条回答
  • 2021-02-12 23:24

    You can consider this as my suggestion. I have done bit research on this and come up with following conclusions.(Also it looks like you have done plenty of research on this so it might be possible that you aware about what I wrote below)

    Numerous apps send Wear specific notifications, and many of those contain actions accessible from an Android Wear device. We can grab those Wear notifications on the device, extracting the actions, finding the reply action (if one exists), populating it with our own response and then executing the PendingIntent which sends our response back the original app for it to send on to the recipient.

    To do so you can refer this link (A nice workaround by Rob J). You can also refer this link in this context (Great research work done by Michał Tajchert).(You might need to work around with NotificationCompat.isGroupSummary)

    This is what I feel(Might be I am totally wrong)

    .actions method returns Array of all Notification.Action structures attached to current notification by addAction(int, CharSequence, PendingIntent), Here addAction method is deprecated one so it might not working as intended.

    I am not able to test this at my end otherwise I will love to provide a working solution with code.

    Hope this will help you. Happy Coding!!!

    0 讨论(0)
提交回复
热议问题