来不及解释,直接上效果图
抓去状态栏消息
Activity
NotificationMonitorService
AndroidManifest.xml
不想敲代码就复制下方代码
Androdi代码
自定义 NotificationMonitorService 继承 NotificationListenerService
import android.app.Notification;
import android.os.Bundle;
import android.service.notification.NotificationListenerService;
impo