You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Notification Listener的onNotificationPosted方法失效求助

求助:通知监听服务无法正常获取通知状态

嘿,我折腾了好几种解决方案和代码,结果全不管用,实在摸不着头脑,麻烦各位大佬帮忙排查!

我在MainActivity里的相关代码是这样的:

if(isNotificationServiceEnabled()) { 
    Intent i= new Intent(this,NotificationsService.class); 
    i.putExtra("command", "get_status"); 
    startService(i); 
} else {
    startActivity(new Intent(Settings.ACTION_NOTIFICATION_LISTENER_SETTINGS));
}

目前我只是想测试服务能不能读取到推送的通知,但从日志里只能看到服务进入onCreate()阶段的内容,之后就没有任何和通知相关的日志输出了,完全获取不到通知信息。

内容的提问来源于stack exchange,提问作者user9746277

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.27 03:27:20