收听传入的 Whatsapp 消息/通知 [英] Listen to incoming Whatsapp messages/notifications

本文介绍了收听传入的 Whatsapp 消息/通知的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发基于通知的应用程序,为此我需要收听传入的通知.我已经能够收听来电、短信、邮件等.我不知道如何通过代码在 Whatsapp 上收听朋友的 ping 或消息.这真的可以做到吗?如果是这样,如何?可以为此使用 无障碍服务,使用包名称作为com.whatsapp"?

I'm working on a notification based app, for which I need to listen to incoming notifications. I've been able to listen to incoming calls, SMS, mail etc. I have no clue how to listen for pings or messages from friends on Whatsapp via code. Can this actually be done? If so, how? Can Accessibility Service be used for this, using Package Name as "com.whatsapp"?

推荐答案

我能够使用 做到这一点无障碍服务.使用它,您可以收听通知栏上的所有通知.我通过将包名称添加到 Accessibility Service service info 来听取应用程序规范,在本例中为 com.whatsapp.我无法阅读消息,但每当有消息到达我都会收到通知.

I was able to do this using Accessibility Service . Using this, you can listen to all notification on the notification bar. I listened to application-specification by adding the package name to the Accessibility Service service info , which in this case was com.whatsapp. I couldn't read the messages, but I get notified whenever a message arrives.

这篇关于收听传入的 Whatsapp 消息/通知的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆