纯原生-如何在不破解情况下使用Android监听支付宝微信收款消息

具体思路:
首先支付宝微信收款均有到账通知,这是其app自带属性,也是为了提醒用户;
然后再规则范围内如何合理利用,在这里我们不说使用xposed这些工具,仅使用手机原生功能如何来做;
思路:
1、新建一个app;
2、监听通知栏消息;
3、判断该通知是否是支付宝或微信到账金额,这里大家可以观察下到账提示,能发现到账的通知和别的通知区别不小;
4、如何获取该通知
4.1 、利用 NotificationListenerService 服务
4.2、利用内部 onNotificationPosted 方法 判断接收内容
4.3、基础代码展示

override fun onNotificationPosted(sbn: StatusBarNotification?) {[/font]        Log.e("NotificationMonitor", "通知栏信息已接收")
        super.onNotificationPosted(sbn)
        sbn?.let {
            val notificationManager = getSystemService(Context.NOTIFICATION_SERVICE) as NotificationManager
            val bundle = it.notification.extras
            val packageName = it.packageName
 
            Log.d("NotificationMonitor", "监控  Notification received from: $packageName")
            Log.d("NotificationMonitor", "监控  Title: ${bundle.getString("android.title")}, Text: ${bundle.getString("android.text")}")
            var actCode = SPStaticUtils.getString(Constant.actCode)
            if (!TextUtils.isEmpty(actCode)){
                when (packageName) {
                    "com.eg.android.AlipayGphone" -> handleAlipayNotification(bundle)
                    "com.tencent.mm" -> handleWeChatNotification(bundle)
                }
            }
        }
    }

至此能获取到收款金额、不使用任何破解方式,均在合理范围内获取。
具体效果:
在这里插入图片描述
当获取到到账金额后能干嘛:
这里带有视频演示效果:https://blog.csdn.net/u014449096/article/details/140021008
核心的功能就是上边的代码块

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

有时有晌

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值